缺省命名空间也要定义名字,并使用它。
 
    Log.ShowMsg("Load {0}",dataFile);
    XmlDocument xmlDoc=new XmlDocument();
    xmlDoc.Load(dataFile);
 
    XmlNamespaceManager nm=new XmlNamespaceManager(xmlDoc.NameTable);
    nm.AddNamespace("c","http://tempuri.org/Cingular Service Plan.xsd");
 
    XmlElement rootNode=xmlDoc.DocumentElement;
    XmlNodeList list=rootNode.SelectNodes("/c:CINGULAR/c:CINGULARCATALOG/c:CATALOG/c:NATIONS",nm);
    Console.WriteLine("Count:"+list.Count.ToString());

相关文章: