? build ? patch ? native/target/Makefile.in ? native/target/Linux/Makefile.in ? native/target/generic/Makefile.in Index: gnu/xml/dom/DomDocumentBuilderFactory.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/DomDocumentBuilderFactory.java,v retrieving revision 1.3 diff -u -r1.3 DomDocumentBuilderFactory.java --- gnu/xml/dom/DomDocumentBuilderFactory.java 23 Feb 2006 20:09:13 -0000 1.3 +++ gnu/xml/dom/DomDocumentBuilderFactory.java 6 Feb 2007 10:04:50 -0000 @@ -43,6 +43,7 @@ import javax.xml.parsers.FactoryConfigurationError; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.DOMConfiguration; +import org.w3c.dom.DOMException; import org.w3c.dom.DOMImplementation; import org.w3c.dom.bootstrap.DOMImplementationRegistry; import org.w3c.dom.ls.DOMImplementationLS; @@ -84,8 +85,38 @@ public DocumentBuilder newDocumentBuilder() throws ParserConfigurationException { - LSParser parser = ls.createLSParser(DOMImplementationLS.MODE_ASYNCHRONOUS, - "http://www.w3.org/TR/REC-xml"); + LSParser parser = null; + try + { + parser = ls.createLSParser(DOMImplementationLS.MODE_ASYNCHRONOUS, + "http://www.w3.org/TR/REC-xml"); + } + catch (DOMException e) + { + if (e.code == DOMException.NOT_SUPPORTED_ERR) + { + // Fall back to synchronous parser + try + { + parser = ls.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, + "http://www.w3.org/TR/REC-xml"); + } + catch (DOMException e2) + { + ParserConfigurationException pce = + new ParserConfigurationException(); + pce.initCause(e2); + throw pce; + } + } + else + { + ParserConfigurationException pce = + new ParserConfigurationException(); + pce.initCause(e); + throw pce; + } + } DOMConfiguration config = parser.getDomConfig(); setParameter(config, "namespaces", isNamespaceAware() ? Boolean.TRUE : Boolean.FALSE); Index: gnu/xml/stream/XIncludeFilter.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/stream/XIncludeFilter.java,v retrieving revision 1.7 diff -u -r1.7 XIncludeFilter.java --- gnu/xml/stream/XIncludeFilter.java 3 Mar 2006 12:30:59 -0000 1.7 +++ gnu/xml/stream/XIncludeFilter.java 6 Feb 2007 10:04:50 -0000 @@ -42,7 +42,6 @@ import java.io.IOException; import java.io.Reader; import java.net.HttpURLConnection; -import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.util.HashSet; @@ -122,17 +121,7 @@ boolean expandERefs) { super(reader); - try - { - this.systemId = XMLParser.absolutize(null, systemId); - } - catch (MalformedURLException e) - { - RuntimeException e2 = new RuntimeException("unsupported URL: " + - systemId); - e2.initCause(e); - throw e2; - } + this.systemId = XMLParser.absolutize(null, systemId); this.namespaceAware = namespaceAware; this.validating = validating; this.expandERefs = expandERefs; Index: gnu/xml/stream/XMLParser.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/xml/stream/XMLParser.java,v retrieving revision 1.30 diff -u -r1.30 XMLParser.java --- gnu/xml/stream/XMLParser.java 7 Jun 2006 13:06:11 -0000 1.30 +++ gnu/xml/stream/XMLParser.java 6 Feb 2007 10:04:54 -0000 @@ -1592,7 +1592,6 @@ * @param href the (absolute or relative) URL to resolve */ public static String absolutize(String base, String href) - throws MalformedURLException { if (href == null) return null; @@ -1622,7 +1621,60 @@ if (!base.endsWith("/")) base += "/"; } - return new URL(new URL(base), href).toString(); + // We can't use java.net.URL here to do the parsing, as it searches for + // a protocol handler. A protocol handler may not be registered for the + // URL scheme here. Do it manually. + // + // Set aside scheme and host portion of base URL + String basePrefix = null; + ci = base.indexOf(':'); + if (ci > 1 && isURLScheme(base.substring(0, ci))) + { + if (base.length() > (ci + 3) && + base.charAt(ci + 1) == '/' && + base.charAt(ci + 2) == '/') + { + int si = base.indexOf('/', ci + 3); + if (si == -1) + base = null; + else + { + basePrefix = base.substring(0, si); + base = base.substring(si); + } + } + else + base = null; + } + if (base == null) // unknown or malformed base URL, use href + return href; + if (href.startsWith("/")) // absolute href pathname + return (basePrefix == null) ? href : basePrefix + href; + // relative href pathname + if (!base.endsWith("/")) + { + int lsi = base.lastIndexOf('/'); + if (lsi == -1) + base = "/"; + else + base = base.substring(0, lsi + 1); + } + while (href.startsWith("../") || href.startsWith("./")) + { + if (href.startsWith("../")) + { + // strip last path component from base + int lsi = base.lastIndexOf('/', base.length() - 2); + if (lsi > -1) + base = base.substring(0, lsi + 1); + href = href.substring(3); // strip ../ prefix + } + else + { + href = href.substring(2); // strip ./ prefix + } + } + return (basePrefix == null) ? base + href : basePrefix + base + href; } /**