Example usage for org.dom4j.io SAXWriter setErrorHandler

List of usage examples for org.dom4j.io SAXWriter setErrorHandler

Introduction

In this page you can find the example usage for org.dom4j.io SAXWriter setErrorHandler.

Prototype

public void setErrorHandler(ErrorHandler errorHandler) 

Source Link

Document

Sets the ErrorHandler.

Usage

From source file:com.alibaba.citrus.springext.util.DomUtil.java

License:Open Source License

/** W3C element??SAX */
public static void convertElement(Element element, ContentHandler contentHandler) throws SAXException {
    SAXWriter writer = new SAXWriter(contentHandler);

    if (contentHandler instanceof ErrorHandler) {
        writer.setErrorHandler((ErrorHandler) contentHandler);
    }/*from   www .  j  a  va 2s .  c  o m*/

    if (contentHandler instanceof LexicalHandler) {
        writer.setLexicalHandler((LexicalHandler) contentHandler);
    }

    writer.write(convertElement(element));
}