File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes Collections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Collections" Watch "Collections" New topic


rima desai

Joined: Oct 18, 2007
Posts: 7
Hi All,
I have an XML File of the following format
<Child id=1>
<Element N>
<Child id=2>
<Element N>
<Child id=n>
Now i want to retrieve the values from this given the child id(i,e if i want to details of child with id=1, i will give the id and i need all the elements falling under child with id=1). could you suggest me which collection to use and it would be of great help if i could get a sample code for it.
Thanks in advance.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
I'm not aware of a collection class that maps to XML - certainly there is none in the core class libraries. Are you familiar with XML processing? The XPath functionality of the JAXP API (which is part of core Java) seems a good fit for this problem; you can find introductions linked in the XML FAQ.
I agree. Here's the link:
subject: Collections
It's not a secret anymore!