且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

跳过xml文件中已注释代码的执行

更新时间:2023-11-24 16:22:34

这取决于您使用什么来解析XML.您可以使用System.Xml.XmlTextReader;在这种情况下,您可以使用其属性Settings或类System.Xml.XmlReaderSettings-它具有属性IgnoreComments可以解决此问题;还有其他非常有用的解析属性.

参见:
http://msdn.microsoft.com/en-us/library/system.xml. xmltextreader.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system.xml. xmlreadersettings.aspx [ ^ ].

—SA
It depends on what are you using for parsing XML. You can use System.Xml.XmlTextReader; in this case, you can use its property Settings or the class System.Xml.XmlReaderSettings — it has a property IgnoreComments which will solve the problem; there are other very useful properties of the parsing.

See:
http://msdn.microsoft.com/en-us/library/system.xml.xmltextreader.aspx[^],
http://msdn.microsoft.com/en-us/library/system.xml.xmlreadersettings.aspx[^].

—SA


使用
跳过代码
例如.
skip code using

for ex..