0
<E st="SS" > <id>789</id> <name>Study Table 1200 C2</name> <vlid>1</vlid> <E st="SS" > <id>567</id> <name>Study Table1</name> <vlid>94611431277729312</vlid> </E> <E st="SS" > <id>345</id> <name>Study -SOFT1</name> <vlid>94611431277729311</vlid> </E> <E st="SS" > <id>123</id> <name>Study Table 02</name> <vlid>94611431277729309</vlid> </E> </E> 

in this i am trying to get the node Value of id where vlid=3. the xpath i have written is (//E[vlid=94611431277729312]/id). the result is <id>567</id>,<id>345</id><id>123</id>

rather i want only one id i.e <id>567</id>. please help me out why i am unable to get the excepted output.

Thanks In Advance

0

2 Answers 2

1

it will work if you will match the value as string

//E[vlid="94611431277729312"]/id 
Sign up to request clarification or add additional context in comments.

1 Comment

You're welcome. I can't give link as to why matching with int will not give the expected results.
0

Try this:

//E[vlid=3]/id[2] 

Like Colin said, try to accept answers that solve your problem.

2 Comments

yes this is working. but i have a huge xml. i have to get the value of the node with its vlid,as its unique to everyone node presents in that xml. any other way is there for this problem?
and now onward i will accept answers that solve my problem also. Thanks

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.