Example usage for org.dom4j.io SAXWriter writeOpen

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

Introduction

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

Prototype

public void writeOpen(Element element) throws SAXException 

Source Link

Document

Writes the opening tag of an Element , including its Attribute s but without its content.

Usage

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

License:Apache License

public void doTag(XMLOutput output) throws JellyTagException {
    Object xpathContext = getXPathContext();

    Object node = xpathContext;/*  w  w  w.j  a  va  2 s . c om*/

    try {
        if (select != null) {
            node = select.selectSingleNode(xpathContext);
        }

        if (node instanceof Element) {
            Element element = (Element) node;

            SAXWriter saxWriter;

            if (lexical) {
                saxWriter = new SAXWriter(output, output);
            } else {
                saxWriter = new SAXWriter(output);
            }

            saxWriter.writeOpen(element);
            invokeBody(output);
            saxWriter.writeClose(element);
        } else {
            invokeBody(output);
        }
    } catch (SAXException e) {
        throw new JellyTagException(e);
    } catch (JaxenException e) {
        throw new JellyTagException(e);
    }
}