Hi mailing list,
I am using JDom to parse XML files. If I am right, you can use SAX as a parser, right?
Im currenty using this code to read in the XML file
FileInputStream fileStream = new FileInputStream(xmlFile);
Charset s = detectFileEncoding(xmlFile);
InputStreamReader streamReader = new InputStreamReader(fileStream, s);
SAXBuilder builder = new SAXBuilder();
doc = builder.build(streamReader);
The detectFileEncoding-Method is based on http://code.google.com/p/juniversalchardet/ and works fine so far.
I’m wondering in which charset SAXBuilder is now storing the characters its getting from the InputStreamReader? Currently, everything works fine and I am getting UTF-8 as charset no matter what I put in.
The other question would be, how I can output the XML data to file in a different encoding than UTF8?
Thanks for your help and regards from Germany,