diff --git a/java/external/src/javax/xml/parsers/DocumentBuilder.java b/java/external/src/javax/xml/parsers/DocumentBuilder.java index a352a30..c732971 100644 --- a/java/external/src/javax/xml/parsers/DocumentBuilder.java +++ b/java/external/src/javax/xml/parsers/DocumentBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2004 The Apache Software Foundation. + * Copyright 2003-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,6 +55,7 @@ import org.xml.sax.SAXException; public abstract class DocumentBuilder { + private static final boolean DEBUG = false; /** Protected constructor */ protected DocumentBuilder () { @@ -173,12 +174,14 @@ public abstract class DocumentBuilder { if (f == null) { throw new IllegalArgumentException("File cannot be null"); } - - String uri = "file:" + f.getAbsolutePath(); - if (File.separatorChar == '\\') { - uri = uri.replace('\\', '/'); + + String escapedURI = FilePathToURI.filepath2URI(f.getAbsolutePath()); + + if (DEBUG) { + System.out.println("Escaped URI = " + escapedURI); } - InputSource in = new InputSource(uri); + + InputSource in = new InputSource(escapedURI); return parse(in); } diff --git a/java/external/src/javax/xml/parsers/SAXParser.java b/java/external/src/javax/xml/parsers/SAXParser.java index 23c0362..b96ce7a 100644 --- a/java/external/src/javax/xml/parsers/SAXParser.java +++ b/java/external/src/javax/xml/parsers/SAXParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2004 The Apache Software Foundation. + * Copyright 2003-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,6 +71,8 @@ import org.xml.sax.helpers.DefaultHandler; * @version $Revision$, $Date$ */ public abstract class SAXParser { + + private static final boolean DEBUG = false; /** *
Protected constructor to prevent instaniation. @@ -285,12 +287,14 @@ public abstract class SAXParser { if (f == null) { throw new IllegalArgumentException("File cannot be null"); } + + String escapedURI = FilePathToURI.filepath2URI(f.getAbsolutePath()); - String uri = "file:" + f.getAbsolutePath(); - if (File.separatorChar == '\\') { - uri = uri.replace('\\', '/'); + if (DEBUG) { + System.out.println("Escaped URI = " + escapedURI); } - InputSource input = new InputSource(uri); + + InputSource input = new InputSource(escapedURI); this.parse(input, hb); } @@ -312,12 +316,14 @@ public abstract class SAXParser { if (f == null) { throw new IllegalArgumentException("File cannot be null"); } + + String escapedURI = FilePathToURI.filepath2URI(f.getAbsolutePath()); - String uri = "file:" + f.getAbsolutePath(); - if (File.separatorChar == '\\') { - uri = uri.replace('\\', '/'); + if (DEBUG) { + System.out.println("Escaped URI = " + escapedURI); } - InputSource input = new InputSource(uri); + + InputSource input = new InputSource(escapedURI); this.parse(input, dh); } diff --git a/java/external/src/javax/xml/transform/stream/StreamSource.java b/java/external/src/javax/xml/transform/stream/StreamSource.java index bfbcfd3..c1595db 100644 --- a/java/external/src/javax/xml/transform/stream/StreamSource.java +++ b/java/external/src/javax/xml/transform/stream/StreamSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2004 The Apache Software Foundation. + * Copyright 2003-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -243,14 +243,15 @@ public class StreamSource implements Source { * @param f Must a non-null File reference. */ public void setSystemId(File f) { - String fpath=f.getAbsolutePath(); - if (File.separatorChar != '/') { - fpath = fpath.replace(File.separatorChar, '/'); - } - if( fpath.startsWith("/")) - this.systemId= "file://" + fpath; - else - this.systemId = "file:///" + fpath; + this.systemId = FilePathToURI.filepath2URI(f.getAbsolutePath()); +// String fpath=f.getAbsolutePath(); +// if (File.separatorChar != '/') { +// fpath = fpath.replace(File.separatorChar, '/'); +// } +// if( fpath.startsWith("/")) +// this.systemId= "file://" + fpath; +// else +// this.systemId = "file:///" + fpath; } //////////////////////////////////////////////////////////////////////