Example usage for org.dom4j.io SAXWriter setContentHandler

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

Introduction

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

Prototype

public void setContentHandler(ContentHandler contentHandler) 

Source Link

Document

Sets the ContentHandler called when SAX events are raised

Usage

From source file:org.dentaku.gentaku.cartridge.event.WerkflowTag.java

License:Apache License

public void doTag(XMLOutput xmlOutput) throws MissingAttributeException, JellyTagException {
    if (metadataClass == null) {
        throw new MissingAttributeException("missing metadata attribute");
    }//  w w  w.  j a v  a 2  s .com
    try {
        Document doc = generateDocument(metadataClass);
        SAXWriter writer = new SAXWriter();
        ContentHandler ctxHandler = new WerkflowContentHandler(xmlOutput);
        writer.setContentHandler(ctxHandler);
        writer.write(doc);

    } catch (Exception e) {
        throw new JellyTagException(e);
    }
}