Search in sources :

Example 1 with PrettyPrintXMLStreamWriter

use of org.grails.web.xml.PrettyPrintXMLStreamWriter in project grails-core by grails.

the class XML method render.

public void render(Writer out) throws ConverterException {
    stream = new StreamingMarkupWriter(out, encoding);
    writer = config.isPrettyPrint() ? new PrettyPrintXMLStreamWriter(stream) : new XMLStreamWriter(stream);
    try {
        isRendering = true;
        writer.startDocument(encoding, "1.0");
        writer.startNode(getElementName(target));
        convertAnother(target);
        writer.end();
        finalizeRender(out);
    } catch (Exception e) {
        throw new ConverterException(e);
    } finally {
        isRendering = false;
    }
}
Also used : StreamingMarkupWriter(org.grails.web.xml.StreamingMarkupWriter) PrettyPrintXMLStreamWriter(org.grails.web.xml.PrettyPrintXMLStreamWriter) ConverterException(org.grails.web.converters.exceptions.ConverterException) XMLStreamWriter(org.grails.web.xml.XMLStreamWriter) PrettyPrintXMLStreamWriter(org.grails.web.xml.PrettyPrintXMLStreamWriter) IOException(java.io.IOException) ConverterException(org.grails.web.converters.exceptions.ConverterException)

Aggregations

IOException (java.io.IOException)1 ConverterException (org.grails.web.converters.exceptions.ConverterException)1 PrettyPrintXMLStreamWriter (org.grails.web.xml.PrettyPrintXMLStreamWriter)1 StreamingMarkupWriter (org.grails.web.xml.StreamingMarkupWriter)1 XMLStreamWriter (org.grails.web.xml.XMLStreamWriter)1