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 15:08:58 UTC

Re[4]: spaces in filenames ...

Hallo Neeraj,

Thursday, December 19, 2002, 8:09:23 PM, you wrote:

>> 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));

> try if the following works for you,
> DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new 
> File(fname));

results in the following exception:

C:\xtest>java -classpath .;xmlParserAPIs.jar;xercesImpl.jar xtest "x 2.xml"
Exception in thread "main" java.net.MalformedURLException: no protocol: entities.dtd
        at java.net.URL.<init>(URL.java:579)
        at java.net.URL.<init>(URL.java:476)
        at java.net.URL.<init>(URL.java:425)
        at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source)
        at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        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.DOMParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
        at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:151)
        at xtest.main(xtest.java:23)

where xtest.java consists of:
    public static void main(String args[]) throws Exception {
        String file = args[0];
        DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder parser = builderFactory.newDocumentBuilder();
        Document doc = parser.parse(new java.io.File(file));
    }

It works when I use "x%202.xml" as filename.

-- 
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