hillion 02/03/20 03:54:04
Modified: sources/org/apache/batik/dom/util SAXDocumentFactory.java
Log:
- Added a way to provide a custom SAX error handler.
Revision Changes Path
1.9 +16 -3
xml-batik/sources/org/apache/batik/dom/util/SAXDocumentFactory.java
Index: SAXDocumentFactory.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/dom/util/SAXDocumentFactory.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SAXDocumentFactory.java 19 Mar 2002 09:25:40 -0000 1.8
+++ SAXDocumentFactory.java 20 Mar 2002 11:54:04 -0000 1.9
@@ -23,6 +23,7 @@
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
+import org.xml.sax.ErrorHandler;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
@@ -36,7 +37,7 @@
* from an URI using SAX2.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a>
- * @version $Id: SAXDocumentFactory.java,v 1.8 2002/03/19 09:25:40 hillion Exp $
+ * @version $Id: SAXDocumentFactory.java,v 1.9 2002/03/20 11:54:04 hillion Exp $
*/
public class SAXDocumentFactory
extends DefaultHandler
@@ -104,6 +105,11 @@
protected HashTableStack namespaces;
/**
+ * The error handler.
+ */
+ protected ErrorHandler errorHandler;
+
+ /**
* Creates a new SAXDocumentFactory object.
* No document descriptor will be created while generating a document.
* @param impl The DOM implementation to use for building the DOM tree.
@@ -191,7 +197,8 @@
parser.setContentHandler(this);
parser.setDTDHandler(this);
parser.setEntityResolver(this);
- parser.setErrorHandler(this);
+ parser.setErrorHandler((errorHandler == null) ?
+ this : errorHandler);
parser.setFeature("http://xml.org/sax/features/namespaces",
true);
@@ -250,6 +257,13 @@
}
/**
+ * Sets a custom error handler.
+ */
+ public void setErrorHandler(ErrorHandler eh) {
+ errorHandler = eh;
+ }
+
+ /**
* <b>SAX</b>: Implements {@link
* org.xml.sax.ContentHandler#startDocument()}.
*/
@@ -378,7 +392,6 @@
* org.xml.sax.ErrorHandler#warning(SAXParseException)}.
*/
public void warning(SAXParseException ex) throws SAXException {
- throw ex;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]