This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML parsing

 
Shreya Menon
Ranch Hand
Posts: 285
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5782
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Shreya Menon
Ranch Hand
Posts: 285
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is something which any parser does.
Here is a DOM tutorial
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic