xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Schildknecht, Karin" <karin.schildkne...@deneb.se>
Subject RE: Unicode problem
Date Wed, 02 May 2001 05:58:28 GMT
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


Mime
View raw message