Re: Bizarre exception using XSLT
Re: Bizarre exception using XSLT
- Subject: Re: Bizarre exception using XSLT
- From: Han Ming Ong <email@hidden>
- Date: Fri, 26 Sep 2003 11:10:10 -0700
On Friday, September 26, 2003, at 02:40 AM, Merul Patel wrote:
Hi,
I found an answer to the discrepancy in that when using the terminal
to perform the XSLT, the Crimson parser was being used, which does
accept the "MacRoman" encoding, while my WO application is for some
reason using the Xerces parser which rejects this encoding. By adding
the line below to the application launch arguments, it forces my WO
application to use the same parser, and now my problem is solved.
D"javax.xml.parsers.SAXParserFactory=org.apache.crimson.jaxp.SAXParserF
actoryImpl"
My sole remaining issue is how to install the Xerces 2.0 parser, and
get the WO App to use this instead. Would be keen to know of solutions
to this.
In WO 5.2, /System/Library/Frameworks/JavaXML.framework has Xerces 2.1
and Xalan 2.4.
What you seeing is probably the effect of Sun uses its rather odd
naming schemes for encoding names:
http://java.sun.com/j2se/1.3/docs/guide/intl/encoding.doc.html
Crimson comes from Sun, so it supports these names naturally :-)
I'm not sure if Xerces support the MacRoman encoding but you can look
at this page
http://xml.apache.org/xerces2-j/features.html
Notice there is a feature
"http://apache.org/xml/features/allow-java-encodings" , turn it on in
WO (if you are instantiating your own parser in WO, then you have
control. If you are using higher level parsers like WOXMLCoder, I'm not
sure if there is a way) and see what happens.
The cleanest solution, if you can afford it, is to standardize on
"UTF-8" (note spelling) encoding, which is rather cheap for Western
languages. This means UTF-8 for the XML files, the database etc...
Good luck.
btw, watch out for various versions of xerces parser laying around in
your system. People have tripped over that before.
BR
Merul
On Thursday, September 25, 2003, at 11:43 pm, Merul Patel wrote:
Hi,
I'm trying to generate PDF from an RTF file using webobjects, and I
have an application that successfully parses an RTF file (at least
for my purposes) and dumps out an XML file using MacRoman character
encoding.
I've written an XSL transformation which takes the created XML file
and converts them into XSL:FO files for generating PDFs. For
expediency I've just used a 3 line function as per the example given
in the SimpleTransformation.java example that accompanies the Apache
Xalan processor. When I test this using javac and java on the command
line, the input XML files encoded using MacRoman character encoding
are correctly transformed to the desired XSL:FO elements which I can
then process using the Apache FOP processor.
However, when I copy the same 3 line function and associated headers
into my Webobjects class files, I get an exception stating an
unrecognised encoding??!!
I have no idea what's going on, since I only have the Apache jar
files that come configured as part of WO 5.1, and the only third
party jars I've put into the /Library/Java/Extension folders are the
FOP.jar, and Batik.jar.
Needless to say, thanks in advance.
Merul
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.