[TestFixture]
public class test
{
[Test]
public void XPathTest()
XmlDocument doc = new XmlDocument();
doc.Load(@"c:\LinqObjects.xsd");
foreach (XmlNode node in doc.DocumentElement.ChildNodes)
{
ProcesNode(node, doc.DocumentElement.Name);
}
}
private void ProcesNode(XmlNode node, string parentPath)
{
if (!node.HasChildNodes || ((node.ChildNodes.Count == 1) && (node.FirstChild is System.Xml.XmlText)))
{
if (node.Name == "Parameter")
{
//System.Diagnostics.Debug.WriteLine(parentPath + "/" + node.Name);
}
}
else
{
foreach (XmlNode child in node.ChildNodes)
{
ProcesNode(child, parentPath + "/" + node.Name);
}
}
}
}
more...
No comments:
Post a Comment