Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading different attributes values in Nodelist with same name

 
Raj Srimandal
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a webservice returning me a response which pretty much looks like this


I have an Xpath Util which uses Xpath to traverese and read this piece of code


But answer 1 and answer 2 retrieved are same..

Any help is appreciated !
 
g tsuji
Ranch Hand
Posts: 656
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've a pile of NodeList and Node variables that do not relate to one another logically and codewise... that make the question very confusing.

For what I understand, you use everywhere absolute path that makes the current node (the context) quite irrelevant and that is the reason. (A side-note: the tag names are case sensitive. response and Response are not the same; also some path is clearly invalid such as /response/question/ with a backslash at the end.)

The general idea is reflected in this clean up that I can abstract out from your post.

Everything is untested but test-ready.>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic