[jdom-interest] JDom API and encoding type?
Ken Rune Helland
kenh at csc.no
Thu Apr 19 08:35:11 PDT 2001
At 05:21 PM 4/19/2001 +0200, you wrote:
>Hi Ken.
>
>Yes, if I'd use an outputter on client side, XMLOutputter.setEncoding(String
>encoding)
>would help.
>
>But I don't. On client side I access the Document with e.g.
>getAttributeValue() method as
>I described in my first mail. I don't need to "output" a complete XML
>Document, I want to use the
>internal representation of a JDOM Document.
>How do I get the encoding information in the JDOM Document?
>
>Barbara
>
How do you get the JDOM document to the client,
I asumed you used XMLOutputter to serialize it
and then reparced it on the client side.
Internaly JDOM uses java String objects wich
allways are in unicode.
Since the parser do not report the encoding, it
translates the document into unicode while parsing,
JDOM does not know about the encoding of the
original document.
KenR
> > -----Original Message-----
> > From: Ken Rune Helland [SMTP:kenh at csc.no]
> > Sent: Donnerstag, 19. April 2001 17:01
> > To: barbara at tli.de; jdom-interest at jdom.org
> > Subject: Re: [jdom-interest] JDom API and encoding type?
> >
> > 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
> > >Declaration.
> > >org.jdom.DocType doesn't offer any methods to include the encoding
> > >part.
> > >
> > >The problem I work on is:
> > >On server side I create a Document with methods of the JDOM API ->
> > ><--SNIP-->
> > >Element rootElement = new Element("Customers");
> > >rootElement.addAttribute("VARID", some_string); //some_string = "äüö123"
> > >Document jdomDoc = new Document(rootElement);
> > >and so on ...
> > ><--SNIP-->
> > >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.
> >
> >
> > KenR
> >
More information about the jdom-interest
mailing list