943,971 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 6283
  • Java RSS
Jun 5th, 2007
0

How to read the parsed XML file (DOM parser)

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
shriyash134 is offline Offline
3 posts
since May 2007
Jun 5th, 2007
0

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

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).
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: How to sign an email using an API
Next Thread in Java Forum Timeline: Btree





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC