Sunday, March 20, 2011

Read an XML file in Java

For previously been discussed about how to convert data to xml, we now discuss for how to parse xml. This is a simple way for parsing the xml file.
The following example code :
XML File :

Output :

Java Code:

There are better implementations of reading XML files which would work for any XML file. The above one would require a few changes every time the XML tag names change. But this is much more simpler than the other programs.

No comments:

Post a Comment