更新时间: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 useSystem.Xml.XmlTextReader
; in this case, you can use its propertySettings
or the classSystem.Xml.XmlReaderSettings
— it has a propertyIgnoreComments
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..