Using java to write XML documents

The basis to work with an XML document or to create an XML document from the scratch is to have a document object in place. So, your first task should be to create a document object using the classes and methods available for that purpose in Java.

_______________________________________________


_______________________________________________

Creating a document object involves three steps. The first is to create a DocumentBuilderFactory object. The second is to create a DocumentBuilder object with that DocumentBuilderFactory object. Now in the third step you can create the Document object using the Document Builder object. A typical code should be,

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
doc = db.newDocument();

You can use the getDocumentElement() method to get the root node and then you can use the appendChild() method to append the elements created, to the root node. To create the text nodes, you can use the method createTextNode() of the document object.

Manipulating the existing XML document is also possible and there are methods to traverse the nodes and to change them or to remove them. You can also traverse the nodes and then create attributes.

IT's an open marriage (CIOL)
The erstwhile Bharat Matrimony group, now Consim, has been trying to tie many knots in the portal world from online matrimony, job searches, buying and selling of property, automobiles, etc.

Saving Your Investment: Transforming J2EE applications into Web 2.0 using GWT (SYS-CON Media)
The pressure is on to keep pace with Web 2.0 entrants into the marketplace. Rewriting is expensive; adding AJAX widgets results in a complex, unmaintainable application. Both require you to hire scarce JavaScript developers. Google Web Toolkit -- the SDK that allows you to write AJAX interfaces in Java -- enables your Java developers to layer a desktop-like interface on top of your Web app. ...



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.

_______________________________________

Recommended XML Books

cover
cover
cover
cover
cover
cover




 

 

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!


New XML Books Titles - Best Seller's @ Amazon.com

Visit XML Training Material Guide Homepage

Technology helps engage students - how do classroom instruction and social dynamics change when the classroom is completely dependant on modern technology?

Dallas Web Design- local Dallas web design firm offers site design and backend system development