This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes XML parsing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML parsing" Watch "XML parsing" New topic
Author

XML parsing

Shreya Menon
Ranch Hand

Joined: Jul 31, 2001
Posts: 285
Hi,
I am looking for a "generic XML parser",
The aim of that parser is,
Given any XML file, it should give me all the name/value pairs as an output.
Has any one used any of these type of parsers.. Any suggestions
Thanks
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
What exactly do you mean by name-value pairs? Are we talking about a level-1 XML document that has nodes nested only upto level-1, so that every node just has one non-node child?
Parsing an XML document involves stepping through the document and tokenizing nodes and elements. What you are describing can be easily achieved by using any standard parser like Xerces. If you haven't already, download Xerces and play with the example code.


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Shreya Menon
Ranch Hand

Joined: Jul 31, 2001
Posts: 285
Ajith,
What I am talking about is, a parser , which can iterate through any levels and extract the Node/value pair ..
as an example
<example>
<name>Maya</name>
<address>
<address1>123 Daves Avenue</address1>
<address2>apt 345</address2>
<city>Campbell</city>
<state>CA</state>
<zipcode>60132</zipcode>
</address>
<Occupation>Software,/Occupation
</example>
So in this case extract the name value pairs as
name : Maya
address1 :.....
Occupation:
This is an XMl with different levels,,,,

Thanks
Maya
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 984

That is something which any parser does.
Here is a DOM tutorial


Please ignore post, I have no idea what I am talking about.
 
wood burning stoves
 
subject: XML parsing
 
Similar Threads
difference between CDATA and PCDATA in XML
Use of common digester to parse large xml file
XML schema
Sun XML Parser Vs Xerces
XSL parser