XML.toJSONObject Throws Exception Though XML is Perfectly Valid (W3C Validated)



I am using a class to crunch XML feeds (RSS feeds like: http://ift.tt/16Ryf4h) into JSONObjects for easy processing. Normally this class works perfect for every feed I give it. Strangely, trying to use Reddit's feeds, which are perfectly valid XML per W3C validators, I get the error:



E/JSON exception﹕ Missing ';' in XML entity: & at character 21607


I threw the feed into Notepad++ and went to character 21607 and found:



"


This appears to be a perfectly valid encoding for XML purposes of the double quote character: ". W3C took the same input and passed 0 warnings or errors, the XML is definitely completely valid.


So, why is XML.toJSONObject failing on valid XML? I've noted it also fails when confronted with:


'


I can't believe some rookie like me is finding a bug, so what's really going on here?


Thank you!


No comments:

Post a Comment