I have parsed a XML file with the DOM parser.
I need assistance in reading the parsed content ...and then preform actions in my java program accrodingly..
Now what i have to do is print some text depending on the value that is ther in the xml element.
for ex:.
i want to do something like this:

if element value from XML = "button" ,then my JAVA prgrm shud print " This is button"

as i am new to JAVA; can any body please help me..i am stuck up here.
if some one can suggest any tutorials with which i can learn how to do this..that wud be nice.

10 Years
Discussion Span
Last Post by jwenting

The DOM API has methods for retrieving sets of child elements from an element given that elements tag name.
You can also retrieve the values of attributes by attribute name.

Using those and given knowledge about the structure of the XML you can address any node/element in the parsed Document.

Some experimenting and reading of the API documentation goes a long way towards understanding how it works.

You may also look at http://xerces.apache.org/xerces2-j/ for tutorials (mind that they may need some modification in details to work with the built-in XML functionality of the core libraries, but the general idea is the same).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.