Example usage for org.jdom2.output XMLOutputter setXMLOutputProcessor

List of usage examples for org.jdom2.output XMLOutputter setXMLOutputProcessor

Introduction

In this page you can find the example usage for org.jdom2.output XMLOutputter setXMLOutputProcessor.

Prototype

public void setXMLOutputProcessor(XMLOutputProcessor processor) 

Source Link

Document

Sets a new XMLOutputProcessor instance for this XMLOutputter.

Usage

From source file:com.googlesource.gerrit.plugins.manifest.ManifestXml.java

License:Apache License

private void printDocument(OutputStream out) throws IOException {
    XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
    outputter.setXMLOutputProcessor(new CustomOutputter(dtdAttributes));

    outputter.output(doc, out);//w  w w.j  a  v a 2 s  .  c  o m
}

From source file:com.tactfactory.harmony.utils.XMLUtils.java

License:Open Source License

/**
 * Write an XML Document to the given file.
 * @param doc The XML document to write// w  w  w.j  a  v a 2 s . c om
 * @param xmlFileName The name of the file
 */
public static void writeXMLToFile(final Document doc, final String xmlFileName) {
    try {
        final File xmlFile = TactFileUtils.makeFile(xmlFileName);
        final XMLOutputter xmlOutput = new XMLOutputter();

        // Write to File
        // Make beautiful file with indent !!!
        xmlOutput.setFormat(Format.getPrettyFormat().setIndent("\t"));
        xmlOutput.setXMLOutputProcessor(new TactXMLOutputter());
        FileOutputStream fos = new FileOutputStream(xmlFile.getAbsoluteFile());

        xmlOutput.output(doc, new OutputStreamWriter(fos, TactFileUtils.DEFAULT_ENCODING));

        fos.close();
    } catch (IOException e) {
        ConsoleUtils.displayError(e);
    }
}

From source file:io.wcm.maven.plugins.contentpackage.unpacker.ContentUnpacker.java

License:Apache License

private void writeXmlWithExcludes(InputStream inputStream, OutputStream outputStream)
        throws IOException, JDOMException {
    SAXBuilder saxBuilder = new SAXBuilder();
    Document doc = saxBuilder.build(inputStream);
    applyXmlExcludes(doc.getRootElement(), "");

    XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat().setLineSeparator(LineSeparator.UNIX));
    outputter.setXMLOutputProcessor(new OneAttributePerLineXmlProcessor());
    outputter.output(doc, outputStream);
    outputStream.flush();/*from  w ww  .  j  av  a  2s. com*/
}