To work
with the XML document in Java, you have to create a document object
in which you can load the XML file. To create the document object you
have to use the classes.
_______________________________________________
_______________________________________________
DocumentBuilderFactory
and the DocumentBuilder. The import statement at the top would contain,
import
org.w3c.dom.Document;
import org.w3c.dom.*;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
which are
mandatory.
Now, you
can create DocumentBuilderFactory object and then use this object's
newDocumentBuilder() method to create the DocumentBuilder object. With
this DocumentBuilder object you can create a Document object that can
be used to load the XML file that you want to use in your Java programming.
After you
have loaded the XML document, you can create a node list by using the
getElementByTagName() method of the document object. This would give
an array and this can be stored in a NodeList object and then can be
looped using "for" loop to print out the elements in the format
you want.
Recent Original Stories (OS News)
"One of the things my team has been working to enable has been the ability for .NET developers to download and browse the source code of the .NET Framework libraries, and to easily enable debugging support in them.
eValid Supports Regular Expressions Analysis of Web Pages (PRWeb via Yahoo! News)
Functional testing of web applications now has a new degree of generality with the introduction of Regular Expression processing in the eValid suite.
Saving Paper (Small Business Computing)
Aside from not pushing "Print" at all, duplex ‑ or double-sided printing ‑ is the easiest way to save paper. It's especially good from reviewing draft documents, manuals and internal documents. "Look for the duplex capability if you're in the market for a new printer," said Waitman.
Recent Original Stories (New Mobile Computing)
At last week's Guadec meeting, Kristian Rietveld delivered the GTK+ "state of the union" report. GTK+ is the multi-platform toolkit behind a number of popular applications and, perhaps most well known, the Gnome Desktop environment for Linux.