summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/gnu/xml/dom/DomDocumentBuilderFactory.java
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2007-02-07 18:22:26 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2007-02-07 18:22:26 +0000
commit7ff59ae90b930096347695fb5ed51d87663749da (patch)
tree6dc3be85930294202aea5c41b9800414ba213f20 /libjava/classpath/gnu/xml/dom/DomDocumentBuilderFactory.java
parente911c3bee65890c840bbfa91c0c64b7de448ad99 (diff)
downloadppe42-gcc-7ff59ae90b930096347695fb5ed51d87663749da.tar.gz
ppe42-gcc-7ff59ae90b930096347695fb5ed51d87663749da.zip
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121694 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/gnu/xml/dom/DomDocumentBuilderFactory.java')
-rw-r--r--libjava/classpath/gnu/xml/dom/DomDocumentBuilderFactory.java35
1 files changed, 33 insertions, 2 deletions
diff --git a/libjava/classpath/gnu/xml/dom/DomDocumentBuilderFactory.java b/libjava/classpath/gnu/xml/dom/DomDocumentBuilderFactory.java
index 02347858002..4d2828af84e 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);
OpenPOWER on IntegriCloud