xml-xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mk...@ca.ibm.com
Subject java.net.MalformedURLException: unknown protocol:
Date Thu, 03 Oct 2002 16:13:25 GMT
Hi,

I have been seeing many user reports for the
"java.net.MalformedURLException: unknown protocol:" problems when using
Xalan. The most likely cause has something to do with spaces in the path.
Here is a simple way to reproduce the problem:

1. Create a Windows directory whose name has space character (e.g. c:\my
files)
2. Put any pair of xml and xsl inside that directory
3. Run Xalan with the following command:
> java org.apache.xalan.xslt.Process -in "c:\my files\test.xml" -xsl "c:\my
files\test.xsl" -EDUMP

You will see the exception:
java.net.MalformedURLException: unknown protocol: c
        at java.net.URL.<init>(URL.java:480)
        at java.net.URL.<init>(URL.java:376)
        at java.net.URL.<init>(URL.java:330)
        at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown
Source)
        at
org.apache.xerces.impl.XMLEntityManager.startDocumentEntity(Unknown Source)
        at
org.apache.xerces.impl.XMLDocumentScannerImpl.setInputSource(UnknownSource)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
        at
org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:983)
        at org.apache.xalan.xslt.Process.main(Process.java:769)

This is actually a Xerces problem. Xerces should replace the space with
"%20" to produce a valid URI. There is a Bugzilla report for this problem
(http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12305). It is still not
fixed at the moment. Currently you can work around it by replacing the long
names with  DOS short names. The following command will work.
> java org.apache.xalan.xslt.Process -in "c:\myfile~1\test.xml" -xsl "c:
\myfile~1\test.xsl"

Remember that this problem can also be reproduced from TRAX API, if you set
the systemId to a String with space in it.

Morris Kwan
XSLT Development
IBM Toronto Lab
Tel: (905)413-3729
Email: mkwan@ca.ibm.com


Mime
View raw message