Magazine
 
XML- SAX Parser using JAXP API

great extend.
SAX is very useful when the document is large. DOM reads the entire XML structure and holds the object tree in memory, so it is much more CPU and memory intensive. For that reason, the SAX API are preferred for server-side applications and data filters that do not require
any memory intensive representation of the data.

Overview of JAXP API’s
JAXP (Java API for XML Processing) doesn’t do any kind of processing instead it provides a mechanism to obtain parsed XML documents employing SAX and DOM parsers. JAXP provides a mechanism to plug-in with various providers (supporting standard specifications
for DOM, SAX and XSLT). JAXP also specifies which provider to use.

Overview of the main JAXP API Packages

The libraries that define needed JAXP APIs are:

 

JAXP APIs

Description

javax.xml.parsers

The JAXP APIs provide a common interface for different vendors' to use SAX and DOM parsers.

org.w3c.dom

Defines the Document class (a DOM) along with the classes for all of the components of a DOM.

org.xml.sax

Defines the basic SAX APIs.

javax.xml.transform

Defines the XSLT APIs that let's to transform XML into other forms.


javax.xml.transform Defines the XSLT APIs that let’s to transform XML into other forms. The SAX API is defined in org.xml.sax package of JAXP-APIs. The “Simple API” for XML (SAX) is the event-driven, serial-access mechanism
that does element-by-element processing. The API for this level reads and writes XML to a data repository or the Web.
 

The DOM API is defined in org.w3c.dom package of JAXP-APIs. The DOM API is easier to use. It provides a tree structure of objects. The DOM API is used to manipulate the hierarchy of application objects it encapsulates.

The XSLT APIs defined in javax.xml.transform package of JAXP-APIs. The XSLT APIs let you convert XML data to into other forms.

javax.xml.parsers —Description Provides classes to process XML documents and supports two types of plugable parsers ie. SAX and DOM Here are the following classses defined in javax.xml.parsers package:

Classes

Description

DocumentBuilder

Defines the API to obtain DOM Document instances from an XML document.

DocumentBuilderFactory

Defines a factory API that enables applications to obtain a parser that produces DOM object trees from XML documents

SAXParser

Defines the API that wraps an XMLReader implementation class

SAXParserFactory

Defines a factory API that enables applications to configure and obtain a SAX based parser to parse XML documents

This package contains two vendor-neutral factory classes: SAXParserFactory (builds a SAXParser) and DocumentBuilderFactory

Feb 2008 | Java Jazz Up | 25
 
previous
index
next
 
View All Topics
All Pages of this Issue
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,

30
, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 , 54, 55, 56, 57,

58
, 59, 60, 61, 62, 63 , 64, 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 ,

Download PDF