Example usage for org.dom4j.io STAXEventWriter STAXEventWriter

List of usage examples for org.dom4j.io STAXEventWriter STAXEventWriter

Introduction

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

Prototype

public STAXEventWriter(XMLEventConsumer consumer) 

Source Link

Document

Constructs a STAXEventWriter that writes events to the provided event stream.

Usage

From source file:org.compass.core.xml.dom4j.converter.STAXReaderXmlContentConverter.java

License:Apache License

public String toXml1(XmlObject xmlObject) throws ConversionException {
    //TODO for some reason, this does not marshall at all, and also, will it be faster than dom4j XMLWriter?
    Dom4jXmlObject dom4jXmlObject = (Dom4jXmlObject) xmlObject;
    StringBuilderWriter stringWriter = StringBuilderWriter.Cached.cached();
    try {//from   ww  w. ja v a  2 s. c o m
        STAXEventWriter xmlWriter = new STAXEventWriter(stringWriter);
        xmlWriter.writeNode(dom4jXmlObject.getNode());
    } catch (XMLStreamException e) {
        throw new ConversionException("Failed to write xml", e);
    }
    return stringWriter.toString();
}