diff options
author | Chris Burdess <dog@gnu.org> | 2007-02-07 18:22:26 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2007-02-07 18:22:26 +0000 |
commit | 08452f45531ca2ec479e61b9f7e37d3fadd95a7b (patch) | |
tree | 6dc3be85930294202aea5c41b9800414ba213f20 /libjava/classpath/gnu/xml/dom | |
parent | 74372bdfc63ac2ba2eaf540f0993b457dca69144 (diff) | |
download | gcc-08452f45531ca2ec479e61b9f7e37d3fadd95a7b.zip gcc-08452f45531ca2ec479e61b9f7e37d3fadd95a7b.tar.gz gcc-08452f45531ca2ec479e61b9f7e37d3fadd95a7b.tar.bz2 |
re PR classpath/30718 (TransformerException in XSLURIResolver)
2007-02-07 Chris Burdess <dog@gnu.org>
Fixes PR 30718.
* gnu/xml/dom/ls/SAXEventSink.java: Add public accessor/mutators.
* gnu/xml/transform/XSLURIResolver.java: Add support for custom
SAXSources without a backing URL or stream.
Fixes PR 27710.
* gnu/xml/dom/DomDocumentBuilderFactory.java: Fall back to synchronous
LSParser if implementation does not support asynchronous.
* gnu/xml/stream/XMLParser.java,
gnu/xml/stream/XIncludeFilter.java: Use custom code instead of
java.net.URL to resolve to an an absolute URI, to avoid nonexistent
protocol handler problems.
From-SVN: r121694
Diffstat (limited to 'libjava/classpath/gnu/xml/dom')
-rw-r--r-- | libjava/classpath/gnu/xml/dom/DomDocumentBuilderFactory.java | 35 | ||||
-rw-r--r-- | libjava/classpath/gnu/xml/dom/ls/SAXEventSink.java | 7 |
2 files changed, 39 insertions, 3 deletions
diff --git a/libjava/classpath/gnu/xml/dom/DomDocumentBuilderFactory.java b/libjava/classpath/gnu/xml/dom/DomDocumentBuilderFactory.java index 0234785..4d2828a 100644 --- a/libjava/classpath/gnu/xml/dom/DomDocumentBuilderFactory.java +++ b/libjava/classpath/gnu/xml/dom/DomDocumentBuilderFactory.java @@ -43,6 +43,7 @@ import javax.xml.parsers.DocumentBuilderFactory; 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 class DomDocumentBuilderFactory 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); diff --git a/libjava/classpath/gnu/xml/dom/ls/SAXEventSink.java b/libjava/classpath/gnu/xml/dom/ls/SAXEventSink.java index 8c5b104..2855400 100644 --- a/libjava/classpath/gnu/xml/dom/ls/SAXEventSink.java +++ b/libjava/classpath/gnu/xml/dom/ls/SAXEventSink.java @@ -111,11 +111,16 @@ public class SAXEventSink interrupted = true; } - protected Document getDocument() + public Document getDocument() { return doc; } + public void setReader(XMLReader reader) + { + this.reader = reader; + } + // -- ContentHandler2 -- public void setDocumentLocator(Locator locator) |