GeeCON Prague 2014*
The moose likes XML and Related Technologies and the fly likes Reading different attributes values in Nodelist with same name 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 "Reading different attributes values in Nodelist with same name" Watch "Reading different attributes values in Nodelist with same name" New topic
Author

Reading different attributes values in Nodelist with same name

Raj Srimandal
Greenhorn

Joined: Mar 13, 2008
Posts: 10
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

Joined: Jan 18, 2011
Posts: 520
    
    3
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.>
 
GeeCON Prague 2014
 
subject: Reading different attributes values in Nodelist with same name