1 / 17

Java API for XML Processing (JAXP)

Java API for XML Processing (JAXP). توسط: محمّدمهدي حامد استاد راهنما: دكتر مسعود رهگذر. XML. Extensible Markup Language W3C Standard XML Documents Well-Formed Element must have an open tag and a close tag One root element that contains all other elements Valid DTD XML Schema.

Download Presentation

Java API for XML Processing (JAXP)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Java API for XML Processing(JAXP) توسط: محمّدمهدي حامد استاد راهنما: دكتر مسعود رهگذر

  2. XML • Extensible Markup Language • W3C Standard • XML Documents • Well-Formed • Element must have an open tag and a close tag • One root element that contains all other elements • Valid • DTD • XML Schema

  3. XML and Java • Java: Portable Language • XML: Portable Data

  4. XML and Java • Java API for XML-Based Web Services (JAX-WS) • Java API for XML Processing (JAXP) • Java Architecture for XML Binding (JAXB) • Java API for XML Messaging (JAXM) • Java API for XML Registries (JAXR) • Java API for XML-Based RPC (JAX-RPC) • Java 2 Platform, Enterprise Edition (J2EE)

  5. JAXP • Java API for XML Processing • Includes • SAX • DOM • XPath • XSLT • …

  6. JAXP • javax.xml Package • javax.xml.parsers • javax.xml.validation • javax.xml.transform • javax.xml.xpath • …

  7. XML Parsers • javax.xml.parsers Package • SAX • Stream Model • DOM • Data Model

  8. SAX • Simple API for XML • An Standard Interface • Different Implementations • Xerces2 (Apache distribution) • Ælfred parser • Apache Crimson parser (in JDK 1.4) • Oracle XML Parser • Piccolo XML Parser • …

  9. SAX • Stream Model • Lightweight and fast • Event-based API • ContentHandler • DTDHandler • ErrorHandler • EntityResolver • …

  10. SAX Example • Events: • startDocument • startElement • startElement • startElement • characters • endElement • …

  11. SAX in Java

  12. SAX • Advantages • Lightweight • Fast • Problems • No Random Access • Can’t Change the Document • Hard to Program • Hard to Navigate the Document

  13. DOM • Document Object Model • An Standard Interface • Data Model • Tree Representation • Two Kinds of Nodes • Element • Text

  14. DOM Tree Traversing • Document Class • Tree Runtime Representation • Methods for Navigation • getFirstChild() • getNextSibling() • getParentNode() • … • Methods for Changing the Document

  15. DOM in Java

  16. DOM • Usually Implements on SAX • SAX is Faster • In-Memory Representation • Tree Representation • Easy to Traverse • Traverse Forward and Backward • Easy to Program

  17. Thanks ?

More Related