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
This commit is contained in:
Chris Burdess
2007-02-07 18:22:26 +00:00
committed by Tom Tromey
parent 74372bdfc6
commit 08452f4553
24 changed files with 155 additions and 29 deletions
@@ -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);