"錯誤" type="hidden"/>

關於"XML 文檔(2, 2)中有錯誤:不應有 "錯誤


XML文件名

<?xml version="1.0" encoding="utf-8"?>
<Config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Enabled>true</Enabled>
  <serverURL>http://127.0.01/Version.xml</serverURL>
  <updateFileList updateInfo="更新說明信息">
    <localFile fileName="bb.exe" fileVersion="" />
  </updateFileList>
</Config>

  程序代碼

XmlSerializer xmlSerializer = new XmlSerializer(typeof(configuration));
            StreamWriter streamWriter = new StreamWriter(file);
            xmlSerializer.Serialize(streamWriter, this);
            streamWriter.Close();

出現錯誤

XML 文檔(2, 2)中有錯誤:不應有 <xml xmlns=''>

 

原因是因為:xml的根節點(Config)和對象名(configuration)不一樣導致的不能反序列化,只要請其中一個名稱改為和另一個一樣就可以通過

本文引用源出處 http://www.cnblogs.com/ZQJia/p/4275214.html,如有侵權請告知本人。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM