You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Michael Mutschler <mi...@mutschler.de> on 2002/12/19 14:29:16 UTC
Re[2]: spaces in filenames ...
Hallo Neeraj,
I just tried a little more:
I have a file "C:\xtest\x 2.xml" containing the following:
<?xml version="1.0"?>
<!DOCTYPE test SYSTEM "entities.dtd">
<test>with entity 2: "&ent2;"</test>
and in the same directory I have the entities.dtd with:
<!ENTITY ent1 "entity1" >
<!ENTITY ent2 "entity2" >
I have the following results when loading the file (tested in
C:\xtest) with the following code:
DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(fname));
1. using "x 2.xml":
java.net.MalformedURLException: no protocol: x 2.xml
2. using "file:/C:/xtest/x 2.xml":
java.net.MalformedURLException: no protocol: entities.dtd
3. using "file:/C:/xtest/x%202.xml":
this one works fine.
The second exception is interesting, because this one happens when I
load my stylesheet with a space in its name.
>> So what is the right way to parse a file using jaxp so all parsers can
>> handle all files?
> If JAXP APIs doesn't accept any file object containing spaces then it should be
> fixed. BTW, what version of Xerces are u using ?
I am using xerces 2.2.1, and I just have put xercesImpl.jar &
xmlParserAPIs.jar into the classpath. The VM ist 1.4.1_01.
>>And can anybody give an example of a (fully) working
>> File->systemID converter?
> You might want to have a look at javax.xml.parsers.ConvertToURI or
> javax.xml.parsers.FilePathToURI. For your purpose, both does the same thing.
> But FilePathToURI also takes care of non-ASCII character.
I haven't found these. I did a full-search over all of the
xerces-javadoc and couldn't find anything, neither in the xml-pack
summer02_01 but ...
> If you are using JDK1.4, you can also use toURI() function of java.io.File
> object.
... that's what I was looking for. Thanks.
--
Best regards,
Michael mailto:michael@mutschler.de
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org