-
1. Re: XML Parser cannot parse Files with spaces in their names
dannyyates Aug 5, 2004 12:15 PM (in response to vc?!)Why are you using the URLDecoder? URLs can't have spaces in, and the string you are passing (apart from having a space in) is not a valid URL.
Can't you just construct the File object direct from the String filename? -
2. Re: XML Parser cannot parse Files with spaces in their names
vc?! Aug 5, 2004 1:50 PM (in response to vc?!)Yes, even if i try
File f =
new File("C:\\jboss-3.2.4\\server\\default\\deploy\\cm.ear\\cm.war\\htm\\Rep\\Gland 5.xml");
boolean b = f.exists();
System.out.println("EXISTS" + b);
Document oDocument = dBuilder.parse(f);
I still get a problem. In the above case b = true. But the Xerces parser I believe has a problem.
2004-08-05 13:46:35,422 INFO [STDOUT] EXISTStrue
2004-08-05 13:46:35,432 INFO [STDOUT] java.io.FileNotFoundException: C:\jboss-3.2.4\server\default\deploy\cm.ear\cm.war\htm\Rep\Gland%205.xml
2004-08-05 13:46:35,432 INFO [STDOUT] at org.jboss.net.protocol.file.FileURLConnection.connect(FileURLConnection.java:71)
2004-08-05 13:46:35,432 INFO [STDOUT] at org.jboss.net.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:80)
2004-08-05 13:46:35,432 INFO [STDOUT] at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
2004-08-05 13:46:35,432 INFO [STDOUT] at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
2004-08-05 13:46:35,432 INFO [STDOUT] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
2004-08-05 13:46:35,432 INFO [STDOUT] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
2004-08-05 13:46:35,432 INFO [STDOUT] at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
2004-08-05 13:46:35,442 INFO [STDOUT] at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
2004-08-05 13:46:35,442 INFO [STDOUT] at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
2004-08-05 13:46:35,442 INFO [STDOUT] at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:161)
The problem goes away if i have a file without any spaces in it -
3. Re: XML Parser cannot parse Files with spaces in their names
dannyyates Aug 6, 2004 4:52 AM (in response to vc?!)Interesting. This does appear to be a bug in your parser. Have you tried the parse(InputStream) method?
-
4. Re: XML Parser cannot parse Files with spaces in their names
andy.hwu Aug 25, 2004 8:40 PM (in response to vc?!)2004-08-05 13:46:35,432 INFO [STDOUT] java.io.FileNotFoundException: C:\jboss-3.2.4\server\default\deploy\cm.ear\cm.war\htm\Rep\Gland%205.xml
2004-08-05 13:46:35,432 INFO [STDOUT] at org.jboss.net.protocol.file.FileURLConnection.connect(FileURLConnection.java:71)
2004-08-05 13:46:35,432 INFO [STDOUT] at org.jboss.net.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:80)
2004-08-05 13:46:35,432 INFO [STDOUT] at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
2004-08-05 13:46:35,432 INFO [STDOUT] at
Here is part of XMLEntityManager.java code in XML Parser,
URL location = new URL(expandedSystemId);
URLConnection connect = location.openConnection();
stream = connect.getInputStream();
XML Parser actually passes the "correct encoded URI" string - expandedSystemId - to URL constructor. In Jboss's FileURLConnection.java, it does not properly decode this input URI string. That is why java.io.FileNotFoundException occurs when connect.getInputStream(); is called. I think it should be fixed in jboss-common.jar instead of XML Parser.