I have a XML code like this:
<?xml version="1.0" encoding="utf-8" ?>
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<Label/>
<Label/>
<Label/>
</Grid>
</Window>
In code, this is represented as a XML Document. The question is in the code that follows:
public XmlNodeList GetAllChildrenOfName(XmlNode parent, string childName)
{
string xpath = childName;
//string xpath = "/" + childName;
//string xpath = "//" + childName;
return parent.SelectNodes(xpath);
}
If I call the method for the grid xml node (GetAllChildrenOfName(gridNode,"Label")
) from the xml code above, it does not return the expected list of 3 labels for any of the suggested xpath values.
Any guesses, how should the xpath look like?
Thanks