一个xml文件 
<公文 xmlns="http://www.....">
  <公文体>
     <内容>sdfsfwef</内容>
   </公文体>
</公文>
我用 selectSingleNode方法查找 <内容>节点 下面的innerText可是 出错。
然而我把 文件改成
<公文>
  <公文体>
     <内容>sdfsfwef</内容>
   </公文体>
</公文>
就对了    我发现问题在 xmlns里面  不知道 如何解决 
请大家帮帮忙

解决方案 »

  1.   

    try something like
          XmlDocument doc = new XmlDocument();
          doc.Load("booksort.xml");      //Create an XmlNamespaceManager for resolving namespaces.
          XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
          nsmgr.AddNamespace("bk", "http://www.....");      //Select the book node with the matching attribute value.
          XmlNode node;
          XmlElement root = doc.DocumentElement;
          node = root.SelectSingleNode("//bk:内容", nsmgr);      Console.WriteLine(node.OuterXml);
    see
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemxmlxmlnodeclassselectsinglenodetopic2.asp