Accessing
XML data using Java is very simple if you use the proper API for that
purpose. One of the simplest ways of accessing XML data using Java is
the use of the Java API for XML Processing (JAXP).
_______________________________________________
You
can download the JAXP library from the Sun Microsystems website and
install it. Detailed specification is also available for download if
you want. Once you have the library in place, you can include the necessary
classes in your program code to gain access to the methods used for
manipulating the XML file.
Importing
org.w3c.dom.Document, org.w3c.dom.DOMException, and org.w3c.dom.Element
are necessary to work with the classes and methods that are needed to
manipulate the XML files.
Just like
you work with the DOM, you have to create the document object to load
the XML file that you need to work with. However creating the document
object is not straightforward. You have to create a DocumentBuilderFactory
and a DocumentBuilder before you create the Document object.
Once you
have the document object loaded, you can use the method available in
it to manipulate the XML document loaded. Lots of sample code is available
in the internet.