I'm using javax.xml.stream.XMLStreamReader
to parse XML documents. Unfortunately, some of the documents I'm parsing use non-IANA encoding names, like "macroman" and "ms-ansi". For example:
<?xml version="1.0" encoding="macroman"?>
<foo />
This causes the parse to blow up with an exception:
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,42]
Message: Invalid encoding name "macroman".
Is there any way to provide a custom encoding handler to my XMLStreamReader
so that I can augment it with support for the encodings I need??