This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes XPath question on returning a list of elements Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XPath question on returning a list of elements" Watch "XPath question on returning a list of elements" New topic
Author

XPath question on returning a list of elements

Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 588
I have the following XML



Using XPath I just want to extract the three rooms.

I have the following java code



The problem is that it just rooms only has one room in it not the 3 I am expecting.

Thanks for any Help
Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 588
Solved it there is only one rooms element to get the room i rest the code as follows



and just remove the room before the attributes when extracting the values
 
Have you checked out Aspose?
 
subject: XPath question on returning a list of elements
 
It's not a secret anymore!