Please help me in finding the xpath for these nodes

<IPAddses>
<IPAddss><ix>0</ix><addss >124.123.123.330</addss ><desc /></IPAddss>
<IPAddss><ix>1</ix><addss >124.123.123.331</addss ><desc /></IPAddss>
<IPAddss><ix>2</ix><addss >124.123.123.332</addss ><desc /></IPAddss>
<IPAddss><ix>3</ix><addss >124.123.123.333</addss ><desc /></IPAddss>
<IPAddss><ix>4</ix><addss >124.123.123.334</addss ><desc /></IPAddss>
<IPAddss><ix>5</ix><addss >124.123.123.335</addss ><desc /></IPAddss>
<IPAddss><ix>6</ix><addss >124.123.123.336</addss ><desc /></IPAddss>
<IPAddss><ix>7</ix><addss >124.123.123.337</addss ><desc /></IPAddss>
<IPAddss><ix>8</ix><addss >124.123.123.338</addss ><desc /></IPAddss>
<IPAddss><ix>9</ix><addss >124.123.123.339</addss ><desc /></IPAddss>
</IPAddses>

in this xml above, i need xpath to get the value of the ipaddresses

eg for getting 124.123.123.330 what xpath should i use?

Recommended Answers

All 3 Replies

/IPAddses/IPAddss/addss

no that will not work, i have tried it already,

/IPAddses/IPAddss/addss

this path will represent all the ip's , say i need to get the first one alone.. there is a nod <ix> which has values 0 to 9.. somehow this node has to be used in the xpath .. bu i am not sure of how to.,,,

Try the below if you want the first IP address

/IPAddses/IPAddss[1]/addss

[1] means the position of <IPAddss>.
If you want to fetch the address depending upon <ix> then try the following

/IPAddses/IPAddss[ix = '0']/addss
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.