1 / 7

XML Parsing Using Java APIs

XML Parsing Using Java APIs. AIP Independence project Fall 2010. XML overview. XML (eXtensible Markup Language) is a language specification created by the W3C A very general version of HTML Format takes the form of arbitrary tags that contain information

vashon
Download Presentation

XML Parsing Using Java APIs

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. XML Parsing Using Java APIs AIP Independence project Fall 2010

  2. XML overview • XML (eXtensible Markup Language) is a language specification created by the W3C • A very general version of HTML • Format takes the form of arbitrary tags that contain information • e.g. <recordCreationDate encoding="w3cdtf">2010-10-06</recordCreationDate> • These tags are defined in XML schema documents (.xsd)

  3. JAXP Java API for XML Processing, the default Java XML library There are two main default interfaces: SAX and DOM

  4. SAX • SAX (Simple API for XML) • Used for serial reading, analogous to a file stream • Triggers events as the cursor reads data • Faster and uses less memory • Doesn’t store the XML file in memory • The user is responsible for keeping track of needed data

  5. DOM • DOM (Document-Object Model) • Creates an actual internal tree representation of the XML • Provides non-sequential access, allowing data to be manipulated at will • Slower and takes more memory

  6. A related API: JAXB • Java API for XML Binding • A separate and somewhat more sophisticated approach • Using the schema document, XML tags are bound as actual Java objects • Allows intuitive coding, but also memory-intensive

  7. A simple example This program uses SAX to print the provided sample MODS document Doesn’t apply any formatting or try to figure out how to use the information yet, but this should be possible using the MODS specification

More Related