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);
}

  

修复使用<code>XmlDocument</code>加载含有DOCTYPE的Xml时,加载后增加“[]”字符的错误的更多相关文章

  1. commonJs的运行时加载和es6的编译时加载

    参考 : https://www.cnblogs.com/jerrypig/p/8145206.html 1.commonJs的运行时加载 2.ES6编译时加载

  2. Swift - 表格图片加载优化(拖动表格时不加载,停止时只加载当前页图片)

    列表的单元格中包含有图片在开发中很常见.通常我们可以直接在tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIn ...

  3. Spring如何加载XSD文件(org.xml.sax.SAXParseException: Failed to read schema document错误的解决方法)

    今天配置Spring的xml出现了错误 Multiple annotations found at this line: - schema_reference.4: Failed to read sc ...

  4. SQL SERVER 重组含有特殊字符的索引时遇到“关键字 'with' 附近有语法错误.”

    案例描述 这是在索引重组过程中遇到的有意思的错误案例,搜索了一下也没有看到相关资料,估计我第一个碰到这类错误的人(It's just a joke).具体情况是YourSQLDba在做维护数据库索引时 ...

  5. 读时加写锁,写时加读锁,Eureka可真的会玩

    大家好,我是三友~~ 在对于读写锁的认识当中,我们都认为读时加读锁,写时加写锁来保证读写和写写互斥,从而达到读写安全的目的.但是就在我翻Eureka源码的时候,发现Eureka在使用读写锁时竟然是在读 ...

  6. 在webpack中使用Code Splitting--代码分割来实现vue中的懒加载

    当Vue应用程序越来越大,使用Webpack的代码分割来懒加载组件,路由或者Vuex模块, 只有在需要时候才加载代码. 我们可以在Vue应用程序中在三个不同层级应用懒加载和代码分割: 组件,也称为异步 ...

  7. 【Dubbo源码阅读系列】之 Dubbo XML 配置加载

    今天我们来谈谈 Dubbo XML 配置相关内容.关于这部分内容我打算分为以下几个部分进行介绍: Dubbo XML Spring 自定义 XML 标签解析 Dubbo 自定义 XML 标签解析 Du ...

  8. 通过 XML HTTP 加载 XML 文件

    新建一个.aspx文件 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="02-通 ...

  9. Linux下显示运行时链接(运行时加载)

    目录 介绍 如何加载动态库 dlopen() 第一个参数: 被加载动态库的路径 第二个参数: flag表示函数符号的解析方式 dlopen 返回值 dlsym() 参数: 返回值 符号优先级 dler ...

随机推荐

  1. RestClient(接口请求)

    一.电子签章:通过接口,传入参数中有pdf文件,和其他参数,在文件上盖上电子签章. 引入:通过NuGet安装RestSharp,注意版本. 备注:如果后面程序运行有错,可以看是引用是否更改了web.c ...

  2. js中关于事件捕获与事件冒泡的小实验

    1.事件冒泡:事件按照从最特定的事件目标到最不特定的事件目标(document对象)的顺序触发. IE 5.5: div -> body -> document IE 6.0: div - ...

  3. skb_store_bits() 和 skb_copy_bits()

    int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len);    int skb_store_bits(c ...

  4. WPF语言切换,国际化

    winform语言切换在每个窗口下面有一个.resx结尾的资源文件,在上面添加新字符串就好了: WPF语言切换跟winform不一样的地方在于需要自己添加资源文件,并且这个资源文件可以写一个,也可以写 ...

  5. Unity DOTS 走马观花

    https://segmentfault.com/a/1190000019143037 本文还在不断完善,可能不会及时同步在 SegmentFault,源文章在我的博客中:萤火之森 - Unity D ...

  6. unity5.5打包

    https://docs.unity3d.com/ScriptReference/BuildPipeline.BuildAssetBundles.html 5.34升5.5打包bundle遇到问题 A ...

  7. HTML5新标签介绍

    一.Datalist 标签 <input list="browsers"> <datalist id="browsers">   < ...

  8. C 语言实例 - 循环输出26个字母

    C 语言实例 - 循环输出26个字母 循环输出 个字母. 实例 #include <stdio.h> int main() { char c; for(c = 'A'; c <= ' ...

  9. eclipse 通过svn导入maven工程

    http://blog.csdn.net/zdnlp/article/details/7238194

  10. python bbs项目代码分析

    def index(request, *args, **kwargs): condition={} type_id = int(kwargs.get("type_id")) if ...