Download presentation
Presentation is loading. Please wait.
Published byCornelius Anderson Modified over 9 years ago
1
Java API for XML Processing (JAXP) توسط : محمّدمهدي حامد استاد راهنما : دكتر مسعود رهگذر
2
XML Extensible Markup Language Extensible Markup Language W3C Standard W3C Standard XML Documents XML Documents Well-FormedWell-Formed Element must have an open tag and a close tag Element must have an open tag and a close tag One root element that contains all other elements One root element that contains all other elements ValidValid DTD DTD XML Schema XML Schema
3
XML and Java Java: Portable Language Java: Portable Language XML: Portable Data XML: Portable Data
4
XML and Java Java API for XML-Based Web Services (JAX-WS) Java API for XML-Based Web Services (JAX-WS) Java API for XML Processing (JAXP) Java API for XML Processing (JAXP) Java Architecture for XML Binding (JAXB) Java Architecture for XML Binding (JAXB) Java API for XML Messaging (JAXM) Java API for XML Messaging (JAXM) Java API for XML Registries (JAXR) Java API for XML Registries (JAXR) Java API for XML-Based RPC (JAX-RPC) Java API for XML-Based RPC (JAX-RPC) Java 2 Platform, Enterprise Edition (J2EE) Java 2 Platform, Enterprise Edition (J2EE)
5
JAXP Java API for XML Processing Java API for XML Processing Includes Includes SAXSAX DOMDOM XPathXPath XSLTXSLT …
6
JAXP javax.xml Package javax.xml Package javax.xml.parsersjavax.xml.parsers javax.xml.validationjavax.xml.validation javax.xml.transformjavax.xml.transform javax.xml.xpathjavax.xml.xpath …
7
XML Parsers javax.xml.parsers Package javax.xml.parsers Package SAX SAX Stream ModelStream Model DOM DOM Data ModelData Model
8
SAX Simple API for XML Simple API for XML An Standard Interface An Standard Interface Different Implementations Different Implementations Xerces2 (Apache distribution)Xerces2 (Apache distribution) Ælfred parserÆlfred parser Apache Crimson parser (in JDK 1.4)Apache Crimson parser (in JDK 1.4) Oracle XML ParserOracle XML Parser Piccolo XML ParserPiccolo XML Parser …
9
SAX Stream Model Stream Model Lightweight and fast Lightweight and fast Event-based API Event-based API ContentHandlerContentHandler DTDHandlerDTDHandler ErrorHandlerErrorHandler EntityResolverEntityResolver …
10
SAX Example Events: Events: startDocumentstartDocument startElementstartElement characterscharacters endElementendElement …
11
SAX in Java
12
SAX Advantages Advantages LightweightLightweight FastFast Problems Problems No Random AccessNo Random Access Can’t Change the DocumentCan’t Change the Document Hard to ProgramHard to Program Hard to Navigate the DocumentHard to Navigate the Document
13
DOM Document Object Model Document Object Model An Standard Interface An Standard Interface Data Model Data Model Tree Representation Tree Representation Two Kinds of NodesTwo Kinds of Nodes Element Element Text Text
14
DOM Tree Traversing Document Class Document Class Tree Runtime RepresentationTree Runtime Representation Methods for NavigationMethods for Navigation getFirstChild() getFirstChild() getNextSibling() getNextSibling() getParentNode() getParentNode() … Methods for Changing the DocumentMethods for Changing the Document
15
DOM in Java
16
DOM Usually Implements on SAX Usually Implements on SAX SAX is FasterSAX is Faster In-Memory Representation In-Memory Representation Tree Representation Tree Representation Easy to TraverseEasy to Traverse Traverse Forward and BackwardTraverse Forward and Backward Easy to Program Easy to Program
17
Thanks?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.