开发者

Parser for .NET that will handle invalid XML [duplicate]

This question already has answers here: How to parse invalid (bad / not well-formed) XML? (4 answers) Closed 5 years ago.

I need to read some XML from a 3rd party source. None of their text fields are wrapped in CDA开发者_运维知识库TA tags, and they can't guarantee that the values won't include invalid characters--I'm particularly thinking of ampersands. They also won't add CDATA tags, because that might break things for their existing clients. Is there a parser out there that would handle this?


Assuming the invalid characters are properly escaped, not included literally in the XML, you can read it with the .NET library by creating an XmlTextReader with the Normalization property set to false. See http://msdn.microsoft.com/en-us/library/system.xml.xmltextreader.normalization.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜