Example The DOM DOMErrorHandler interface
package org.w3c.dom;
public interface DOMErrorHandler {
public boolean handleError(DOMError error);
In Xerces-2, the XMLSerializer class implements the DOMWriter interface, so if you prefer you can use these methods instead of the ones discussed in the last section. Example 13.5 demonstrates a complete program that builds a simple SVG document in memory and writes it into the file circle.svg in the current working directory using a \r\n line end and the UTF-16 encoding. The error handler is set to an anonymous inner class that prints error messages on System.err and returns false to indicate that processing should stop when an error is detected.
Post a comment