Example usage for org.jdom2.output XMLOutputter XMLOutputter

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

Introduction

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

Prototype

public XMLOutputter(XMLOutputProcessor processor) 

Source Link

Document

This will create an XMLOutputter with the specified XMLOutputProcessor.

Usage

From source file:org.fnppl.opensdx.keyserverfe.Helper.java

License:Open Source License

public static void elementToWriter(Document e, OutputStreamWriter w) {
    if (e == null)
        return;//from   w  w  w .  j  ava 2  s.co m

    try {
        org.jdom2.output.Format f = org.jdom2.output.Format.getPrettyFormat();
        f.setEncoding(XML_OUTPUTTER_CHARSET);
        XMLOutputter xmlOutputter = new XMLOutputter(f);

        xmlOutputter.output(e, w);
    } catch (Exception x) {
        x.printStackTrace();
        return;
    }
}

From source file:org.fnppl.opensdx.keyserverfe.Helper.java

License:Open Source License

public static void elementToWriter(Element e, OutputStreamWriter w) {
    if (e == null)
        return;/*from w ww  . j a  v  a2s  . com*/

    try {
        org.jdom2.output.Format f = org.jdom2.output.Format.getPrettyFormat();
        f.setEncoding(XML_OUTPUTTER_CHARSET);
        XMLOutputter xmlOutputter = new XMLOutputter(f);

        xmlOutputter.output(e, w);
    } catch (Exception x) {
        x.printStackTrace();
        return;
    }
}

From source file:org.fnppl.opensdx.keyserverfe.MyAction.java

License:Open Source License

public final static String getStringXML(Element e, String encoding) {
     org.jdom2.output.Format f = org.jdom2.output.Format.getCompactFormat();
     f.setEncoding(encoding);/*w  w  w . j  a  v a 2s.c  o m*/
     XMLOutputter xout = new XMLOutputter(f);

     return xout.outputString(e);

 }

From source file:org.fnppl.opensdx.keyserverfe.MyAction.java

License:Open Source License

public final static String getCuteXML(Element e) {
     org.jdom2.output.Format f = org.jdom2.output.Format.getPrettyFormat();
     f.setEncoding("UTF-8");
     XMLOutputter xout = new XMLOutputter(f);

     return xout.outputString(e);

 }

From source file:org.fnppl.opensdx.xml.Document.java

License:Open Source License

public void output(OutputStream out) {
    try {/*from w ww.  j  a  va 2  s .com*/
        Format f = Format.getPrettyFormat();
        f.setEncoding("UTF-8");
        XMLOutputter outp = new XMLOutputter(f);
        outp.output(base, out);
        out.flush();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:org.fnppl.opensdx.xml.Document.java

License:Open Source License

public void outputCompact(OutputStream out) {
    try {/*www  .j  a  v a 2s. c om*/
        Format f = Format.getCompactFormat();
        f.setEncoding("UTF-8");
        XMLOutputter outp = new XMLOutputter(f);
        outp.output(base, out);
        out.flush();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:org.fnppl.opensdx.xml.Document.java

License:Open Source License

public String toString() {
    try {//from   ww  w .j a v a2  s  .c  o  m
        Format f = Format.getPrettyFormat();
        f.setEncoding("UTF-8");
        XMLOutputter outp = new XMLOutputter(f);
        StringWriter sw = new StringWriter();
        outp.output(base, sw);
        sw.flush();

        return sw.toString();
    } catch (IOException e) {
        e.printStackTrace();
    }

    return null;
}

From source file:org.fnppl.opensdx.xml.Document.java

License:Open Source License

public byte[] toByteArray() {
    try {//from www.  j  a v a  2 s . c  o  m
        Format f = Format.getPrettyFormat();
        f.setEncoding("UTF-8");
        XMLOutputter outp = new XMLOutputter(f);
        return outp.outputString(base).getBytes("UTF-8");
    } catch (IOException e) {
        e.printStackTrace();
    }

    return null;
}

From source file:org.fnppl.opensdx.xml.Document.java

License:Open Source License

public String toStringCompact() {
    try {/*from w w  w .j av  a  2s.c om*/
        Format f = Format.getCompactFormat();
        f.setEncoding("UTF-8");
        XMLOutputter outp = new XMLOutputter(f);
        StringWriter sw = new StringWriter();
        outp.output(base, sw);
        sw.flush();

        return sw.toString();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:org.gemoc.xdsmlframework.ide.ui.builder.pde.PluginXMLHelper.java

License:Open Source License

public void saveDocument(IFile pluginXmlFile) {
    try {/*from ww  w. j ava 2  s  .  co m*/
        XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat());

        ByteArrayOutputStream stream = new ByteArrayOutputStream();

        sortie.output(document, stream);
        InputStream inputStream = new ByteArrayInputStream(stream.toByteArray());
        pluginXmlFile.setContents(inputStream, IResource.FORCE, null);
    } catch (IOException e) {
        Activator.error(e.getMessage(), e);
    } catch (CoreException e) {
        Activator.error(e.getMessage(), e);
    }
}