
An example for reading XML with JavaReading XML with java can be done easily if you are using the Java API for XML Processing. You can download this API and if you want the specifications too from the Sun Microsystems website.
_______________________________________________ Once you have the Java API in place, it is needed to have the proper imports in your program. Typical imports statements might have, import
org.w3c.dom.Document; The next step is to create a document object to load the XML file that should be read. If you have loaded the XML object then it is easy to traverse the nodes of the XML document and access all the nodes of the XML document. Creating a document object involves three steps as given in the code below. DocumentBuilderFactory
fact = DocumentBuilderFactory.newInstance(); once the document object is loaded with the XML document you can use the methods like getDocumentElement().getNodeName() to get the root node of the XML document and use getElementsByTagName() to get all the elements of a particular name and then loop through them to display them. Methods to change the attributes, create attributes, change nodes, and to remove nodes are also available.
IntelliJ Idea9 ActionScript 3/Flex Workflow Part 2 (O'Reilly Media) dot.Rory (BBC News) ExtenXLS 8 Java Spreadsheet SDK now with PDF Support (PRWeb via Yahoo! News)
|
Cisco
CCNA Certification Video Tutorial Guide - Learn How to Pass the Cisco
CCNA 640-802 Exam... Guaranteed!
| |||
|
| ||||