Search in sources :

Example 1 with XmlNodePrinter

use of groovy.util.XmlNodePrinter in project camel by apache.

the class XmlParserDataFormat method newPrinter.

private XmlNodePrinter newPrinter(OutputStream stream) {
    XmlNodePrinter xmlNodePrinter = new XmlNodePrinter(new PrintWriter(stream));
    xmlNodePrinter.setNamespaceAware(isNamespaceAware());
    return xmlNodePrinter;
}
Also used : XmlNodePrinter(groovy.util.XmlNodePrinter) PrintWriter(java.io.PrintWriter)

Example 2 with XmlNodePrinter

use of groovy.util.XmlNodePrinter in project groovy by apache.

the class XmlUtil method asString.

private static String asString(Node node) {
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    XmlNodePrinter nodePrinter = new XmlNodePrinter(pw);
    nodePrinter.setPreserveWhitespace(true);
    nodePrinter.print(node);
    return sw.toString();
}
Also used : XmlNodePrinter(groovy.util.XmlNodePrinter)

Example 3 with XmlNodePrinter

use of groovy.util.XmlNodePrinter in project groovy-core by groovy.

the class XmlUtil method asString.

private static String asString(Node node) {
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    XmlNodePrinter nodePrinter = new XmlNodePrinter(pw);
    nodePrinter.setPreserveWhitespace(true);
    nodePrinter.print(node);
    return sw.toString();
}
Also used : XmlNodePrinter(groovy.util.XmlNodePrinter)

Aggregations

XmlNodePrinter (groovy.util.XmlNodePrinter)3 PrintWriter (java.io.PrintWriter)1