What is the XPath syntax that returns multiple nodes from XML?
Say I have XML like so:
<Contacts>
<Contact>
<Name>
<FirstName>Andre</FirstName>
<LastName>Levy</LastName>
</Name>
<DOB>
<Year>1970</Year>
<Month>5</Month>
<Day>13</Day>
</DOB>
</Contact>
<Contact>
<Name>
<FirstName>Bob</FirstName>
<LastName>Fisher</LastName>
</Name>
<DOB>
<Year>1983</Year>
<Month>7</Month>
<Day>24</Day>
</DOB>
</Contact>
</Contacts>
What XPath will give me:
<Contacts>
<Contact>
<FirstName>Andre</FirstName>
<Year>1970</Year>
</Contact>
<Contact>
<FirstName>Bob</FirstName>
<Year>1983</Year>
</Contact>
</Contacts>
I tried: //FirstName | //Year
But that only yields:
<FirstName>Andre</FirstName>
<FirstName>Bob</FirstName>
<Year>1970</Year>
<Year>1983</Year>
What gives?
You can select multiple nodes in XPath, but you cannot re-arrange XML in the manner exhibited in your requested output.
Also note:
|
you suggest, however...