Вы находитесь на странице: 1из 2

XML DOM

The Document Object Model (DOM) is a cross-platform and language-independent


convention for representing and interacting with objects in HTML, XHTML and XML
documents. Aspects of the DOM (such as its "Elements") may be addressed and
manipulated within the syntax of the programming language in use. The public interface
of a DOM is specified in its Application Programming Interface (API).
The XML DOM defines a standard way for accessing and manipulating XML documents.
The DOM presents an XML document as a tree-structure.

What is the DOM?

The DOM is a W3C (World Wide Web Consortium) standard.

The DOM defines a standard for accessing documents like XML and HTML:

"The W3C Document Object Model (DOM) is a platform and language-neutral interface
that allows programs and scripts to dynamically access and update the content, structure,
and style of a document."

The DOM is separated into 3 different parts / levels:

Core DOM - standard model for any structured document


XML DOM - standard model for XML documents
HTML DOM - standard model for HTML documents

The DOM defines the objects and properties of all document elements, and the
methods (interface) to access them.

What is the XML DOM?

The XML DOM is:

A standard object model for XML


A standard programming interface for XML
Platform- and language-independent
A W3C standard

The XML DOM defines the objects and properties of all XML elements, and the
methods (interface) to access them.

In other words: The XML DOM is a standard for how to get, change, add, or delete
XML elements.
SAX
SAX (Simple API for XML) is a sequential access parser API for XML. SAX provides a
mechanism for reading data from an XML document. It is a popular alternative to the
Document Object Model (DOM).

XML processing with SAX

A parser which implements SAX (ie, a SAX Parser) functions as a stream parser, with an
event-driven API. The user defines a number of callback methods that will be called
when events occur during parsing. The SAX events include:

XML Text nodes


XML Element nodes
XML Processing Instructions
XML Comments

Events are fired when each of these XML features are encountered, and again when the
end of them is encountered. XML attributes are provided as part of the data passed to
element events.

SAX parsing is unidirectional; previously parsed data cannot be re-read without starting
the parsing operation again.

Вам также может понравиться