70 likes | 98 Views
Learn why XML parsers are essential, how to check XML syntax, validate with DTD and XML Schema, and utilize SAX or DOM for programmatic access and data processing.
E N D
Why Need a XML Parser ? • Check XML syntax . ( is well-formed ? ) • Validation. ( DTD and XML Schema ) • Allow programmatic access to the document’s content. ( SAX、DOM、… )
SAX vs. DOM • A SAX-based parser processes the document and generates events when tags、text、… are encountered. • A DOM-based parser builds a tree structure containing the XML document’s data in memory.
Examples • Creating Nodes. ( BuildXml.java ) • Traversing the DOM. ( TraverseDOM.java )
XML Parser List • Apache Xerces http://xml.apache.org • IBM XML4J http://alphawork.ibm.com/tech/xml4j • Sun Microsystems JAXP http://java.sun.com/xml/ • James Clark XP http://www.jclark.com/xml/xp • Oracle XML Parser http://technet.oracle.com/tech/xml