Understanding Java API for XML processing (JAXP)

If you want to process XML document using Java, then you can use JAXP. JAXP stands for Java API for XML Processing. You can download these API from the Sun website sun.com. You can get the specifications and also the source code from the website.


_______________________________________________

JAXP has a set of classes and methods that are used to process XML documents. Classes to create DocumentBuilderFactory, DocumentBuilder, and Documents are available.

There are methods to create elements, get all the elements of an XML document by tag names, create text nodes, and to append the text nodes to the root nodes or other elements.

Element rt = (Element) doc.createElement("book");
rt.appendChild( doc.createTextNode("some_book") );

Consider the above two statements that is used as a part of a java program used to handle the XML documents. The first statement creates an element that is supposed to the root element and the next statement adds a text node to it.

The 'doc' is the document object that was previously created. To create a document object you have to create DocumentBuilderFactory and then a DocumentBuilder. Lots of samples are available in the internet.




_______________________________________________

FREE Subscription

Subscribe to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.

Name:
Email:

Note : We never rent, trade, or sell my email lists to
anyone. We assure that your privacy is respected
and protected.

_______________________________________




 

 

FREE Subscription

Stay Current With the Latest Technology Developments Realted to XML. Signup for Our Newsletter and Receive New Articles Through Email.

Name:

Email:

Note : We never rent, trade, or sell our email lists to anyone. We assure that your privacy is respected and protected.

 

 

Add to My Yahoo!

Visit XML Training Material Guide Homepage

 

 

Copyright - © 2004 - 2017 - All Rights Reserved.