Working with the XML Parser API — JSR 172

Vikram Goyal’s article, “Working with the XML Parser API — JSR 172,” now up on otn/java, covers the basics of the XML Parsing API via a concrete example that uses SAX (Simple API for XML), a parsing method which is now preferred to the alternative method, and DOM (Document Object Model), which has a heavy memory footprint that led the XML Parser API to disallow its use in XML processing. “The XML Parser API,” explains Goyal, “defines the use of the SAX parser for parsing XML documents in resource-constrained devices.”

 

He explains through a working example what the SAX parser is, how it is defined by the API, and how best to use it.

 

From the article:

 

“In a nutshell, for the parsing of a custom XML document, you need to create a handler that extends the DefaultHandler class provided by the API. This custom handler is responsible for listening to the events from the parser and creating the model based on those events (and the supplied data). Your handler is responsible for validating the document and its data.”

 

Read the article.

 

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Insider News from the Java Team at Oracle!

duke
javeone logo
Links


Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
2
5
6
7
12
13
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today