spaces in filenames ... 2003-01-06 - By sandygao@(protected)
Are you sure you are using the correct xmlParserAPIs.jar? (Or is it possible that another version of JAXP got loaded?) The exception trace worries me: for all Xerces code, it says "Unknown Source" in the trace, but for JAXP code, there is the line number "DocumentBuilder.java:151". If the xmlParserAPIs.jar generated by Xerces is used, there shouldn't be such line number.
Note that the fix is in Xerces' JAXP code, so you have to use that to get the fix.
Cheers, Sandy Gao Software Developer, IBM Canada (1-905) 413-3255 sandygao@(protected)
Michael Mutschler <michael@(protected) To: Neeraj Bajaj <Neeraj .Bajaj@(protected)> r.de> cc: xerces-j-user@(protected) .apache.org Subject: Re[4]: spaces in filenames ... 12/19/2002 09:08 AM Please respond to xerces-j-user
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@(protected)
--------------------------------------------------------------------- To unsubscribe, e-mail: xerces-j-user-unsubscribe@(protected) For additional commands, e-mail: xerces-j-user-help@(protected)
--------------------------------------------------------------------- To unsubscribe, e-mail: xerces-j-user-unsubscribe@(protected) For additional commands, e-mail: xerces-j-user-help@(protected)
|
|