[jdom-interest] how to specify encoding when using JDOMSource and TraX

Elliotte Rusty Harold elharo at metalab.unc.edu
Mon Oct 7 17:36:01 PDT 2002


At 5:45 PM -0400 10/7/02, Frank Sauer wrote:
>When running the following code:
>
>	StreamSource s = getXSL();
>	Transformer transformer = null;
>	synchronized(TFactory) {
>		transformer = TFactory.newTransformer(s);
>	}
>	Document doc = new Document();
>	doc.setRootElement(dataXML);
>	JDOMResult result = new JDOMResult();
>	JDOMSource source = new JDOMSource(doc);
>	transformer.transform(source, result);
>
>Note that dataXML is a JDOM Element obtained from database data.
>It was never read from an XML file.
>
>I occasionaly get the error:
>
>'bad continuation of multi-byte UTF-8 sequence (character code: 0x63)'
>
>when using Saxon 6.5.1 and a JDOMSource.
>
>My question is: where do I specify that the input xml is iso-8859-1
>and not utf-8 (even though I think it is, I'm just trying to make this
>error go away...)

No, I doubt this is your problem. Once you've got a JDOM Document 
object, the  encoding is irrelevant. It's all handled automatically 
You haven't shown your whole code, but it seems likely that one of 
your input documents or stylesheet sis malformed and needs to be 
fixed.
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|          XML in a  Nutshell, 2nd Edition (O'Reilly, 2002)          |
|              http://www.cafeconleche.org/books/xian2/              |
|  http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/  |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list