xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Cates" <cat...@home.com>
Subject Re: Unicode problem
Date Wed, 02 May 2001 23:24:13 GMT
Actually, it was the other way around.  I was using a Reader, and when I
changed it to an InputStream, it all worked fine.  Your message jolted my
memory about something in the JAXP API spec regarding readers and streams.
The spec states:

"Normally streams should be used rather than readers or writers, for both
the Source and Result, since readers and writers already have the encoding
established to and from the internal Unicode format. However, there are
times when it is useful to write to a character stream, such as when using a
StringWriter in order to write to a String, or in the case of reading source
XML from a StringReader."

Thanks

Jon


----- Original Message -----
From: "Schildknecht, Karin" <karin.schildknecht@deneb.se>
To: <general@xml.apache.org>
Sent: Wednesday, May 02, 2001 1:58 AM
Subject: RE: Unicode problem


> Jon,
> Your problem might depend on the Source (xml) you are using and how you
> constructed it. I had the same problem constructing a StreamSource with a
> java.io.InputStream. Constructing it with a java.io.Reader (i.e.
> StringReader) on the other hand it worked perfect.
> Hope that could help!
>
> Regards,
> Karin
>
> -----Original Message-----
> From: Jonathan Cates [mailto:catesj@home.com]
> Sent: den 1 maj 2001 02:37
> To: general@xml.apache.org
> Subject: Unicode problem
>
>
> I am working on a project that is using the German language.  All our xml
is
> supposed to be headed with iso-8859-1.  Some data was recently loaded to
the
> database, and I am suddenly getting the following exception:
>
> SystemId Unknown; Line 292; Column 24; ; Line#: 292; Column#: 24
> javax.xml.transform.TransformerException: An invalid XML character
(Unicode:
> 0x1e) was found in the element content of the document.
>         at
>
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:
> 660)
>         at
>
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:
> 1118)
>
>
> Where the code looks like:
> public void process(Source xml, Source xsl, Writer out){
>         try{
>
>              TransformerFactory tFactory;
>              Transformer serializer;
>
>                          tFactory = TransformerFactory.newInstance();
>
>             serializer = tFactory.newTransformer(xsl);
>
serializer.setOutputProperty(OutputKeys.ENCODING,"iso-8859-1");
>             serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,
> "yes");
>             serializer.transform(xml ,new StreamResult(out));
>         }catch(Exception ex){
>             ex.printStackTrace();
>
> .....
>
> Is there something I have missed here.  If the doc doesn't have the
> encoding="iso-8859-1" should this matter if I explictly set it?  I am
using
> v2 of xalan/xerces.  Any help is appreciated.
>
> Thanks
> Jon
>
> ---------------------------------------------------------------------
> In case of troubles, e-mail:     webmaster@xml.apache.org
> To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org
>
>



---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Mime
View raw message