XML structure question
- by Andrew Jahn
I have a basic XML object that I'm working with. I can't figure out how to access the parts of it.
EX:<br>
<pre><code>
< FacetsData>
< Collection name="CDDLALL" type="Group">
< SubCollection name="CDDLALL" type="Row">
< Column name="DPDP_ID">D0230< /Column>
< Column name="Count">9< /Column>
< /SubCollection>
< SubCollection name="CDDLALL" type="Row">
< Column name="DPDP_ID">D1110< /Column>
< Column name="Count">9< /Column>
< /SubCollection>
< /Collection>
< /FacetsData>
(PS: I can't get this damn xml to format so people can read it)
What I need to do is check each DPDP_ID and if its value is D0230
then I leave the Count alone, all else I change the Count to 1.
What I have so far:
node = doc.DocumentElement;
nodeList = node.SelectNodes("/FacetsData/Collection/SubCollection");
for (int x = 0; x < nodeList.Count; x++) {
if (nodeList[x].HasChildNodes) {
for (int i = 0; i < nodeList[x].ChildNodes.Count; i++) {
//This part I can't figure out how to get the name="" part of the xml
//MessageBox.Show(oNodeList[x].ChildNodes[i].InnerText); get the "D0230","1"
//part but not the "DPDP_ID","Count" part.
}
}
}