Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Xml The Document Object Model (DOM) APIs

Related Tutorials


 
 

Share on Google+Share on Google+

The Document Object Model (DOM) APIs

Advertisement
In this section, you will learn the Document Object model(DOM) APIs.

The Document Object Model (DOM) APIs

     

The DOM Packages

 

 

 

 

 

 

 

 

The Document Object Model implementation is defined in the following packages:

Package Description
org.w3c.dom This package defines the DOM programming interfaces for XML documents, as per with the specifications defined by the W3C.
javax.xml.parsers This package defines the DocumentBuilderFactory class and the DocumentBuilder class. The DocumentBuilder class, returns an object needed to implement the W3C Document interface. The factory that creates the builder is determined by the javax.xml.parsers system property. This package also defines the ParserConfigurationException  class to deal with  errors.

The diagram here shows the JAXP APIs to process xml document using the DOM parser:

 

javax.xml.parsers.DocumentBuilderFactory class creates the instance of DocumentBuilder. Through  DocumentBuilder it  produces a Document (a DOM) that conforms to the DOM specification.  The System property determines , the builder at the run time using javax.xml.parsers.DocumentBuilderFactory (it selects the factory implementations  to produce the builder). The  platform's default value ie..system property can be overridden from the command line.


DocumentBuilder
newDocument() method can also be used . It creates an empty Document that implements the org.w3c.dom.Document interface.

Alternatively, one of the builder's parse methods can be used to create a Document from existing XML data. As a result, a DOM tree like that shown in the diagram.

     

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: May 25, 2007

Related Tutorials

Discuss: The Document Object Model (DOM) APIs  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com