[jdom-interest] JDom API and encoding type?

Ken Rune Helland kenh at csc.no
Thu Apr 19 08:01:13 PDT 2001

At 04:43 PM 4/19/2001 +0200, barbara at tli.de wrote:
>Hi there!
>How Do I get the encoding type into my Document.
>I want <?xml version="1.0" encoding="ISO-8859-1"?> in my Document Type
>org.jdom.DocType doesn't offer any methods to include the encoding
>The problem I work on is:
>On server side I create a Document with methods of the JDOM API ->
>Element rootElement = new Element("Customers");
>rootElement.addAttribute("VARID", some_string); //some_string = "äüö123"
>Document jdomDoc = new Document(rootElement);
>and so on ...
>On client side I don't use an Outputter, only the
>methods of Document and Element to view the data in a JTree. The strings
>these methods give back differ from the input on server side.
>E.g. the method getAttributeValue gives back some_string="auo123"
>I hope that specifying the encoding in the Declaration will
>solve my problem.
>Any suggestions? Thanx for help.

Tell the XMLOutputter witch encoding to output in
using XMLOutputter.setEncoding(String encoding).

Then the output will not only containt the encoding
attribute but also actually be in this encoding.


More information about the jdom-interest mailing list