C# 读取XML

注意事项:

1   var xmlReaderSettings = new XmlReaderSettings
2             {
3                 IgnoreComments = true, //忽略注释
4                 IgnoreWhitespace = true, //忽略无关紧要的空白
5                 IgnoreProcessingInstructions = true  //忽略处理指令
6             };

读取带DTD外部文件的XML:

如果只需要读取本XML与DTD没关系  可以忽略:

1 XmlDocument xmldoc = new XmlDocument();
2 xmldoc.XmlResolver = null;

能够良好的读取XML,否则会报错:找不到*.dtd文件

posted on 2015-03-13 16:19  夜雨梧桐  阅读(191)  评论(0编辑  收藏  举报

导航