You can
use Java to parse the XML documents. There are classes available in
Java for this purpose. It is easy to work with an XML document, navigate
through the elements, and edit or print it out, if you use the proper
classes and methods available for this purpose.
_______________________________________________
_______________________________________________
To
work with an XML document using Java, you have to import certain packages
and classes. The following import statements are needed to work with
an XML document using Java.
import
org.w3c.dom.Document;
import org.w3c.dom.*;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
Once you
import these in your Java program, you can create a document object
that can be used to load the XML document and work with it. There are
three steps involved in creating a document object. You would have created
it straight in other scripting languages.
In Java
you have to create a DocumentBuilderFactory object, then a DocumentBuilder
and then finally the Document object. Methods like newDocumentBuilder()
of the DocumentBuilderFactory is used to create the DocumentBuilder
object and then the Document object is created using the DocumentBuilder
object.
Once the
Document object is available you can use the getElementByTagName() method
to get all the elements of a particular name and load them in a NodeList.
Use a "for" loop to work with those elements.
Google open sources XML alternative Protocol Buffers (CNET via Yahoo! News)
XML, it seems, has run out of steam for Google.
Google open sources XML alternative Protocol Buffers (ZDNet Asia)
Software company releases software for encode data in multiple formats in a single binary format for network communications or storage.