How to tell Java SAX Parser to ignore invalid character references?

Posted by Epaga on Stack Overflow See other posts from Stack Overflow or by Epaga
Published on 2010-06-08T12:33:05Z Indexed on 2010/06/08 12:52 UTC
Read the original article Hit count: 479

Filed under:
|
|
|
|

When trying to parse incorrect XML with a character reference such as &#x1, Java's SAX Parser dies a horrible death with a fatal error such as

    org.xml.sax.SAXParseException: Character reference "&#x1"
                                   is an invalid XML character.

Is there any way around this? Will I have to clean up the XML file before I hand it off to the SAX Parser? If so, is there an elegant way of going about this?

© Stack Overflow or respective owner

Related posts about java

Related posts about Xml