dol: initial dol commit
[jump.git] / dol / src / dol / parser / xml / XmlErrorHandler.java
diff --git a/dol/src/dol/parser/xml/XmlErrorHandler.java b/dol/src/dol/parser/xml/XmlErrorHandler.java
new file mode 100644 (file)
index 0000000..d1105bd
--- /dev/null
@@ -0,0 +1,45 @@
+/* $Id: XmlErrorHandler.java 1 2010-02-24 13:03:05Z haidw $ */
+package dol.parser.xml;
+
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ *  This class ...
+ */
+
+public class XmlErrorHandler extends DefaultHandler {
+
+    /**
+     * Empty constructor
+     */
+    public XmlErrorHandler() {
+        super();
+    }
+
+    /**
+     *  Treat validation errors as fatal
+     *
+     * @param  e Description of the Parameter
+     * @exception  SAXParseException MyException If such and such occurs
+     */
+    public void error(SAXParseException e)
+             throws SAXParseException {
+        System.out.println("Error found: " + e.getMessage());
+        throw e;
+    }
+
+    /**
+     *  Dump warnings too
+     *
+     * @param  err Description of the Parameter
+     * @exception  SAXParseException MyException If such and such occurs
+     */
+    public void warning(SAXParseException err)
+             throws SAXParseException {
+        System.out.println("** Warning"
+                + ", line " + err.getLineNumber()
+                + ", uri " + err.getSystemId());
+        System.out.println("   " + err.getMessage());
+    }
+}