aspose file tools*
The moose likes XML and Related Technologies and the fly likes XML Parsing help needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML Parsing help needed " Watch "XML Parsing help needed " New topic
Author

XML Parsing help needed

Perak Patel
Greenhorn

Joined: Sep 10, 2004
Posts: 12
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

Joined: Mar 22, 2000
Posts: 12806
    
    5
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
 
subject: XML Parsing help needed