Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Detection of encoding of XML file with the StAX parser

843834May 24 2006 — edited May 25 2006
Hello!

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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 22 2006
Added on May 24 2006
1 comment
366 views