[jdom-interest] encoding?

Jason Hunter jhunter at collab.net
Sun Apr 8 18:49:12 PDT 2001


elephantwalker wrote:
> 
> I just noticed that if I have a root element like this:
> 
> <?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
> <someroot>
>   somecontent
> </someroot>
> 
> If I read this into jdom, and then use an outputter, the file becomes:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <someroot>
>   somecontent
> </someroot>
> 
> ...is this by design, on the todo list, or just a bug?

With regard to the encoding, SAX doesn't report the encoding on the
original, so it can't be preserved if you build with SAXBuilder. 
XMLOutputter uses UTF-8 as the default encoding on output which is
pretty standard in XML.

With regard to the standalone flag, that too isn't reported by SAX and a
"no" value is the default if it's unlisted.

Bottom line: The two docs above are semantically equivalent and as close
as possible to the original as can be done building with SAX.

-jh-



More information about the jdom-interest mailing list