I have xml in format below:
<rows>
<rows>
<primitiveValue>000</primitiveValue>
</rows>
<rows>
<primitiveValue>58316</primitiveValue>
</rows>
<rows>
<primitiveValue>133083.0</primitiveValue>
</rows>
</rows>
<rows>
<rows>
<primitiveValue>001</primitiveValue>
</rows>
<rows>
<primitiveValue>66018</primitiveValue>
</rows>
<rows>
<primitiveValue>172546.0</primitiveValue>
</rows>
</rows>
I need to split the data per parent element of rows, but don't know how to do this.
I've tried the code below, but this loops through every instance of rows and causes duplication.
string Values = "";
foreach (XElement element in xDoc.Descendants("rows"))
{
foreach (XElement childElement in element.Descendants("rows").Elements("primitiveValue"))
{
Values = Values + "," + childElement.Value.ToString();
}
}
Can someone help please?