Hi all,
I have a XML document that has the following structure (example):
What I want to do is to check if a node has children or not, based on two parameters (parent node, node name). Say I call my function like this: GetNode("CPU", "INTEL").
How would I do this using the XMLDocument class/object??
Would something like this work? :
private XmlNode oNode;
XmlDocument oXMLDoc = new XmlDocument();
string sNodeName = "INTEL";
string sParentNode = "CPU";
FileStream oFileStream = new FileStream(FILEPATH,FileMode.Open,FileAccess.Read,FileShare.ReadWrite);
oXMLDoc.Load(oFileStream);
oNode = oXMLDoc.SelectSingleNode("descendant::"+ ParentNode +"["+ NodeName +" = "+ NodeName +"]");
I'm new to the whole XML thing, so excuse me if my "suggestion" is totally off!
Thank you!