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文件