Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XPath question on returning a list of elements

 
Tony Evans
Ranch Hand
Posts: 598
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 598
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic