修复使用codeXmlDocument/code加载含有DOCTYPE的Xml时,加载后增加“[]”字符的错误...
生活随笔
收集整理的這篇文章主要介紹了
修复使用codeXmlDocument/code加载含有DOCTYPE的Xml时,加载后增加“[]”字符的错误...
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
C# LINQ TO XML - Remove “[]” characters from the DTD header
http://stackoverflow.com/questions/12358061/c-sharp-linq-to-xml-remove-characters-from-the-dtd-header
public static void FixDocumentType(this XmlDocument xml){if (xml?.DocumentType == null)return;var name = xml.DocumentType.Name;var publicId = xml.DocumentType.PublicId;var systemId = xml.DocumentType.SystemId;var parent = xml.DocumentType.ParentNode;var documentTypeWithNullInternalSubset = xml.CreateDocumentType(name, publicId, systemId, null);if (parent == null || xml.DocumentType == null)return;parent.ReplaceChild(documentTypeWithNullInternalSubset, xml.DocumentType);}
轉載于:https://www.cnblogs.com/maozhh/p/6731581.html
總結
以上是生活随笔為你收集整理的修复使用codeXmlDocument/code加载含有DOCTYPE的Xml时,加载后增加“[]”字符的错误...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 蓝桥杯 1427 买不到的数目
- 下一篇: Gibbs sampling