How to read the parsed XML file (DOM parser)

Reply

Join Date: May 2007
Posts: 3
Reputation: shriyash134 is an unknown quantity at this point 
Solved Threads: 0
shriyash134 shriyash134 is offline Offline
Newbie Poster

How to read the parsed XML file (DOM parser)

 
0
  #1
Jun 5th, 2007
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.
Shriyash.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: How to read the parsed XML file (DOM parser)

 
0
  #2
Jun 5th, 2007
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).
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC