• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML Parsing help needed

 
Perak Patel
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I need to parse an xml file say customer.xml which contains the foll:

<addressbook>
<person>
<id>1</id>
<fistname>james</firstname>
<lastname>bond</lastname>
<address>usa</address>
</person>
<person>
<id>2</id>
<fistname>micheal</firstname>
<lastname>jannet</lastname>
<address>usa</address>
</person>
</addressbook>


Now when a particular customer is been selected by some process [say id=1]then , i need to filter that customers xml & pass it back .i.e. my o/p should be as under :

<person>
<id>1</id>
<fistname>james</firstname>
<lastname>bond</lastname>
<address>usa</address>
</person>


Any light on how to approach this or sample code using any parsers [SAX,DOM,Xerces] is appreciated.

Thanks.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13048
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should go through one of the many Java and XML tutorials on the web.
For example, this one at Sun.
Yours is a common problem and the tutorials contain sample code.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic