XML Parsing Models
Home ] Up ] Validating XML Parsers ] Non-Validating XML Parsers ] [ XML Parsing Models ] XML Checkers & Validators ]

 

 

The two most popular programming models for parsing XML documents are:

  • The Simple API for XML (SAX)

    SAX uses an event-driven model: the client application is continuously notified as document features are recognized by the parser.

    SAX was developed by a group of people on the XML-DEV mailing list (http://www.xml.org/xml/xmldev.shtml).  It is now a universally accepted de facto standard

  • The Document Object Model (DOM)

    DOM uses an object-driven model: the entire XML document is parsed and stored as a tree hierarchy of objects (nodes), which the client application can subsequently access, as needed.

    DOM was developed by the World Wide Web Consortium (W3C) (http://www.w3.org/DOM/), and is now a W3C standard.

A useful discussion of how the models work, and their pros and cons may be found at http://www.oracle.com/technology/oramag/oracle/03-sep/o53devxml.html .

Some other interesting approaches are:

  • Java API for XML Parsing (JAXP)

    JAXP provides an abstraction layer to XML parser implementations (both DOM and SAX), and applications that process Extensible Stylesheet Language Transformations (XSLT).

  • JDOM (http://jdom.org/)
  • dom4j (http://dom4j.org/)

    Both JDOM and dom4j are open source projects that have developed a Java-specific API to take advantage of specific Java language features.

 

 
The page was last updated February 19, 2008