XML DOM
1
XML DOM 
The XML DOM defines a standard for accessing and
manipulating XML.
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.
2
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
3
What is the XML DOM?
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.
4
XML SAX
SAX (Simple API for XML) is an event-
based sequential access parser API developed by the
XML-DEV mailing list for XMLdocuments.
SAX provides a mechanism for reading data from an
XML document that is an alternative to that provided by
the Document Object Model (DOM).
SAX parsers operate on each piece of the XML
document sequentially.
5
Benefits
SAX parsers have some benefits over DOM-style parsers.
 A SAX parser only needs to report each parsing event as it
happens, and normally discards almost all of that information
once reported
Thus, the minimum memory required for a SAX parser is
proportional to the maximum depth of the XML file (i.e., of
the XML tree) and the maximum data involved in a single.
 XML event (such as the name and attributes of a single start-
tag, or the content of a processing instruction, etc.)
6
Drawbacks
The event-driven model of SAX is useful for XML parsing,
but it does have certain drawbacks.
Virtually any kind of XML validation requires access to the
document in full. The most trivial example is that an
attribute declared in the DTD to be of type IDREF, requires
that there be an element in the document that uses the same
value for an ID attribute.
To validate this in a SAX parser, one must keep track of all
ID attributes (any one of them might end up being referenced
by an IDREF attribute at the very end); as well as every
IDREF attribute until it is resolved.
7

Xml3

  • 1.
  • 2.
    XML DOM  The XMLDOM defines a standard for accessing and manipulating XML. 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. 2
  • 3.
    The DOM isseparated 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 3
  • 4.
    What is theXML DOM? 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. 4
  • 5.
    XML SAX SAX (Simple APIfor XML) is an event- based sequential access parser API developed by the XML-DEV mailing list for XMLdocuments. SAX provides a mechanism for reading data from an XML document that is an alternative to that provided by the Document Object Model (DOM). SAX parsers operate on each piece of the XML document sequentially. 5
  • 6.
    Benefits SAX parsers havesome benefits over DOM-style parsers.  A SAX parser only needs to report each parsing event as it happens, and normally discards almost all of that information once reported Thus, the minimum memory required for a SAX parser is proportional to the maximum depth of the XML file (i.e., of the XML tree) and the maximum data involved in a single.  XML event (such as the name and attributes of a single start- tag, or the content of a processing instruction, etc.) 6
  • 7.
    Drawbacks The event-driven modelof SAX is useful for XML parsing, but it does have certain drawbacks. Virtually any kind of XML validation requires access to the document in full. The most trivial example is that an attribute declared in the DTD to be of type IDREF, requires that there be an element in the document that uses the same value for an ID attribute. To validate this in a SAX parser, one must keep track of all ID attributes (any one of them might end up being referenced by an IDREF attribute at the very end); as well as every IDREF attribute until it is resolved. 7