Download presentation
Presentation is loading. Please wait.
1
XML Parser
2
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 、 … )
3
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.
4
DOM ( Document Object Model) Node DocumentNodeList Processing I Character data CommentText CDATA section ElementAttr
5
DOM ( Document Object Model) Document Document type Element Attribute Element Text CommentElement Attribute
6
Examples Creating Nodes. ( BuildXml.java )BuildXml.java Traversing the DOM. ( TraverseDOM.java )TraverseDOM.java
7
XML Parser List Apache Xerces http://xml.apache.orghttp://xml.apache.org IBM XML4J http://alphawork.ibm.com/tech/xml4jhttp://alphawork.ibm.com/tech/xml4j Sun Microsystems JAXP http://java.sun.com/xml/http://java.sun.com/xml/ James Clark XP http://www.jclark.com/xml/xphttp://www.jclark.com/xml/xp Oracle XML Parser http://technet.oracle.com/tech/xmlhttp://technet.oracle.com/tech/xml
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.