[xml] One question about XPath



Hello Daniel,

I have a question about XPath.

Let's supposed we have the following xml doc:

<main>

 <label_1>
  <sublabel_1>value1</sublabel_1>
  <sublabel_2>response1</sublabel_2>
 </label_1>

 <label_1>
  <sublabel_1>value2</sublabel_1>
  <sublabel_2>response2</sublabel_2>
 </label_1>

 <label_1>
  <sublabel_1>value3</sublabel_1>
  <sublabel_2>response3</sublabel_2>
 </label_1>

</main>

- My question is: Can I use XPath in order to obtain the <sublabel_2> 
value (responseX) from <sublabel_1> value (valueX)?. 
- Could you tell me what XPath "expresion" I have to use, please?

This means, with the "valueX" I would like to obtain "responseX" using 
XPath (is it possible?)

- For example:
  Whit the "value2" and the XPath "expresion" I want to 
obtain "response2". 

I am very gratefull if you could answer my questions.

Thank you very much in advanded and regards,
Manuel (Spain)







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]