[jdom-interest] JDom API and encoding type?

Jason Hunter jhunter at collab.net
Thu Apr 19 11:23:21 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
> >Declaration.
> >org.jdom.DocType doesn't offer any methods to include the encoding
> >part.

Just FYI, that's not your Document Type Declaration.  The DTD is the
thing that looks like <!DOCTYPE...>

> >On client side I don't use an Outputter, only the
> >methods of Document and Element to view the data in a JTree. 

Then you're fine.  The chars will be read from whatever file encoding
and stored in memory as standard Unicode.  Then you can display the
Unicode chars in a GUI the same way you'd display any chars.  Just make
sure you have the right fonts enabled.

> >these methods give back differ from the input on server side.
> >E.g. the method getAttributeValue gives back some_string="auo123"

getAttributeValue() will return the proper string as was read in.  It
may not output correctly unless you do the right thing.  The earlier
advice about XMLOutputter's encoding option given by others will help
you if you're writing XML as bytes.

-jh-



More information about the jdom-interest mailing list