xml文件如下:
<?xml version='1.0' encoding='UTF-8'?>
<cp:gtl xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:cp='urn:schemas-microsoft-com/contentpublishing/content'
xmlns:ns1='http://www.w3.org/1999/xhtml'
xmlns:dfs='http://schemas.microsoft.com/office/infopath/2003/dataFormSolution'
xmlns:tns='http://tempuri.org/'
xmlns:my='http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-04-15T01:10:45'
xmlns:xd='http://schemas.microsoft.com/office/infopath/2003'xml:lang='ja'>
<cp:Test>
<id1>aaa</id1>
<id2>bb</id2>
<check1>false</check1>
<ImageUrl>R0lGODdhaAIBAIABAKrM7gAAACwAAAAAaAIBAAACF4SPqcvtD6OctNqLs968+w+G4kiWZlYAADs=</ImageUrl>
</cp:Test>
</cp:gtl>用
 XmlDocument doc = new XmlDocument();
doc.LoadXml(strXml);load这个xml的时候老报错,不知道怎么解决

解决方案 »

  1.   

    你的XML文档无效吧?我试试先。
      

  2.   

    xmlns:xd='http://schemas.microsoft.com/office/infopath/2003'xml:lang='ja'> 
    ---》
    xmlns:xd='http://schemas.microsoft.com/office/infopath/2003' xmlns:lang='ja'> 字符串错了~~~
      

  3.   

    XmlDocument doc = new XmlDocument(); 
    doc.LoadXml(strXml); 
    XmlNamespaceManager nsmanager = new XmlNamespaceManager(doc.NameTable);
                nsmanager.AddNamespace("cp","http://www.w3.org/2001/XMLSchema-instance")你有命名空间
    要加上才可以
      

  4.   

    哈哈,果然没错。加一个空格:
    xmlns:xd='http://schemas.microsoft.com/office/infopath/2003'xml:lang='ja'> 
    <cp:Test> 上面这里:infopath/2003'xml:lang='ja'> 
    在2003'与xml:lang之间加一个空格,再加载吧!!
      

  5.   

    The XML page cannot be displayed 
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. 
    --------------------------------------------------------------------------------缺少所需的空白区。处理资源 'file:///C:/Users/Luzf/Desktop/a.xml' 时出错。第 8 行,位置: 61 xmlns:xd='http://schemas.microsoft.com/office/infopath/2003'xml:lang='ja'> 
    --------------------------------------------...
      

  6.   

    xmlns:xd='http://schemas.microsoft.com/office/infopath/2003'(这里少一个空格)xml:lang='ja'