Example usage for org.dom4j.io SAXContentHandler startDocument

List of usage examples for org.dom4j.io SAXContentHandler startDocument

Introduction

In this page you can find the example usage for org.dom4j.io SAXContentHandler startDocument.

Prototype

public void startDocument() throws SAXException 

Source Link

Usage

From source file:org.apache.commons.jelly.tags.xml.ParseTagSupport.java

License:Apache License

/**
 * Parses the body of this tag and returns the parsed document
 *//*from   w  w  w.j  a  v  a  2s .  c  o  m*/
protected Document parseBody(XMLOutput output) throws JellyTagException {
    SAXContentHandler handler = new SAXContentHandler();
    XMLOutput newOutput = new XMLOutput(handler);

    try {
        handler.startDocument();
        invokeBody(newOutput);
        handler.endDocument();
        return handler.getDocument();
    } catch (SAXException e) {
        throw new JellyTagException(e);
    }
}

From source file:org.apache.commons.jelly.tags.xmlunit.XMLUnitTagSupport.java

License:Apache License

/**
 * Parses the body of this tag and returns the parsed document
 *//* w w w. j  a  va  2  s  . c o  m*/
protected Document parseBody() throws JellyTagException {
    SAXContentHandler handler = new SAXContentHandler();
    XMLOutput newOutput = new XMLOutput(handler);
    try {
        handler.startDocument();
        invokeBody(newOutput);
        handler.endDocument();
    } catch (SAXException e) {
        throw new JellyTagException(e);
    }
    return handler.getDocument();
}