Hi..
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.

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).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.