You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by mi...@objectweb.org on 2004/06/01 16:57:32 UTC
xalan + xerces resolver.jar == malformed URI
I'm using ANT 1.6.1 to drive the transformation of several XML documents.
I wanted to validate the result, so I added <xmlvalidate> task to the ANT
build. This resulted in an error due to malformed URI. It took a while
to find the problem (go check the xerces archives for details).
My xslt contained a call to document() that used a Windows file name. The
xslt runs fine using absolute windows filename "c:\bla\bla\bla.xml"
<xsl:variable name='doc2' select='document("c:\bla\bla\bla.xml")'/>
When I added the <xmlvalidate> task to the ANT script, I noticed that
validation was taking about 5-8 seconds per file. This turns out to be
caused by namespace references to remote schema files in the generated
xml. To reduce the execution time on the <xmlvalidate> I added
resolver.jar to the classpath (C:\xerces-2_6_2\resolver.jar) and defined
CatalogManager.properties and a catalog that mapped the remote schema
files to local file system copies.
With resolver.jar on the classpath, I started getting transformation
failures due to malformed URI.
file://c:/bla/bla/bla.xml
NOTE that the URI should be file:///c:/... with 3 slashes following the
file:.
The error message generated by the xslt task was not very helpful (see
below). Instead of issuing a message about the malformed URI, it gave me
a java.lang.reflect.InvocationTargetException error. I had to run ANT with
verbose mode and examine the stack trace to find a malformed URI message.
[xslt]
resolveURI(C:/java/j2eetck/src/com/sun/ts/tests/ejb/ee/deploy/entity/cmp11/single/ejb_depEcmp11_single_ejb.jar.sun-ejb-jar.xml)
[xslt] C:/GIROUX/JOnAS/TCK_DD_Porting_Tool/templates/sun2jonas.xslt:40:70:
Fatal Error! java.lang.reflect.InvocationTargetException Cause:
java.lang.reflect.InvocationTargetException
[xslt]
file:/C:/GIROUX/JOnAS/TCK_DD_Porting_Tool/templates/jonas-ejb-jar.xslt:256:49:
Fatal Error! Fatal error during transformation Cause: Fatal error during
transformation
With all that as background, let me recap --
ANT <xslt> runs without error if resolver.jar is NOT on the classpath.
ANT <xslt> fails with an obscure java.lang.reflect.InvocationTargetException error if resolver.jar IS on
the classpath.
I think the XALAN document() function to be changed to convert the
filename argument to a proper URI prior to trying to process the file?
Michael Giroux