I found (C# samples):
Code: Select all
XDocument doc = XDocument.Load(cPDFName);
var allElements = doc.Descendants("Zoom200").Select(element => element.Value).ToArray();
string[]AllPos = doc.Descendants("pos").Select(n => n.Value).ToArray();
var allnodes2 = doc2.SelectNodes("//Zoom200");
The first line returns allElemens but this is only 1 array element with all "pos" values in 1 line
The second line returns a string array with all requested "pos" values but it also includes for all zoom values for Zoom300
The third lines returns the contents of Zoom200 but how to get these "pos" values from it? InnerText is also 1 line (with "10-20-30") instead of an array of these 3 values.
It must be something simple I overlook or couldn't find.
Dick
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Doc>
<Zoom200>
<pos>10</pos>
<pos>20</pos>
<pos>30</pos>
</Zoom200>
<Zoom300>
<pos>100</pos>
<pos>200</pos>
<pos>300</pos>
</Zoom300>
</Doc>