I'm using the StreamReaderDelegate and want to use umlauts (ÄÜÖ).
My initialisation of the StAX parser:
public class GraphDataStreamReader extends StreamReaderDelegate {
public GraphDataStreamReader(XMLStreamReader streamReader) throws XMLStreamException {
super(streamReader);
}
...
}
....
XMLInputFactory factory = XMLInputFactory.newInstance();
graphSR = new GraphDataStreamReader(
factory.createXMLStreamReader(new FileReader(xmlFile)));
My XML File is marked with UTF-8 (also tried 16, 32).
What can i do?
The FileReader
uses the platform's default character encoding and will corrupt the file content if your XML file uses a different encoding.
Use a FileInputStream
instead:
factory.createXMLStreamReader(new FileInputStream(xmlFile))