Detection of encoding of XML file with the StAX parser
843834May 24 2006 — edited May 25 2006Hello!
I am using the StAX parser to read an XML file which can have different encodings.
I don't know how to detect the encoding before reading the file.
This is the way I instantiate the reader now:
XMLStreamReader xmlr = xmlif.createXMLStreamReader(new InputStreamReader (new FileInputStream(inputfile), "utf-8"));
Is there any way to make the reader detect the encoding with StAX? Is it possible detect the encoding with SAX or DOM?
Just paste some piece of code and you will help me a lot!
Thanks,
Lara