Link to home
Start Free TrialLog in
Avatar of rnicholus
rnicholus

asked on

Want to continue parsing XML feed even though invalid character met (using Apache Xerces)

Hi,

I have an XML file from a http URL which I need to parse. When I do this using
Apache Xerces SAX parser, I get a fatal error with the message "Invalid byte 1 of 1-byte UTF-8 sequence". And then the parsing will be stopped. But I need to
continue parsing the file even if an invalid character is met. I don't mind
if that particular data is skipped. Can anybody advise (and give an example)?

Thanks in advance for the help.
org.xml.sax.SAXParseException: Invalid byte 1 of 1-byte UTF-8 sequence.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rnicholus
rnicholus

ASKER

It works. Thanks!
:-)