File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Spring in Action this week in the Spring forum!
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: 579
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: 579
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XPath question on returning a list of elements