string strXml ="<?xml version=\"1.0\" encoding=\"utf-8\"?>"+
"<objects xmlns=\"http://www.fubar.net\">"+
"<description>"+
"This is the primary configuration file."+
"</description>"+
"<import resource=\"assembly://MyCoolAssm.Config/SuperDuper.xml\" />"+
"<import resource=\"./Milk.Generated.xml\" />"+
"<import resource=\"./Sugar.Generated.xml\" />"+
"</objects>";
XmlDocument xDoc = new XmlDocument();
xDoc.LoadXml(strXml);
XmlNamespaceManager xMan = new XmlNamespaceManager(xDoc.NameTable);
xMan.AddNamespace("myNs", "http://www.fubar.net");
XmlNodeList xnList = xDoc.SelectNodes("/myNs:objects/myNs:import",xMan);
int countNode = xnList.Count;
No comments:
Post a Comment