开发者

How do I still read an RSS with a missing xml header tag?

I am using C#'s xmlTextReader to parse an RSS xml file. It works fine except when there is a missing header tag. How do I get aro开发者_C百科und this issue without injecting the header myself?


You could use XmlTextReader.Settings.ConformanceLevel property set to ConformanceLevel.Fragment. But that will relax some other validation checks.


I got around this by implementing Peter Bromberg's custom RSS reader. It is more work compared to using Microsoft's inbuilt reader, however, you can tweak Bromberg's reader to handle errors in the RSS feed with ease.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜