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
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).
Joined: Jul 31, 2001
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,,,,