Search in sources :

Example 1 with XMLWriter

use of de.pdark.decentxml.XMLWriter in project fabric8 by jboss-fuse.

the class CamelNamespaces method xmlToText.

public static String xmlToText(Node node) throws IOException {
    StringWriter buffer = new StringWriter();
    XMLWriter writer = new XMLWriter(buffer);
    node.toXML(writer);
    writer.close();
    return buffer.toString();
}
Also used : StringWriter(java.io.StringWriter) XMLWriter(de.pdark.decentxml.XMLWriter)

Example 2 with XMLWriter

use of de.pdark.decentxml.XMLWriter in project tycho by eclipse.

the class ProductConfiguration method write.

public static void write(ProductConfiguration product, File file) throws IOException {
    OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
    Document document = product.document;
    try {
        String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8";
        Writer w = new OutputStreamWriter(os, enc);
        XMLWriter xw = new XMLWriter(w);
        try {
            document.toXML(xw);
        } finally {
            xw.flush();
        }
    } finally {
        IOUtil.close(os);
    }
}
Also used : OutputStream(java.io.OutputStream) FileOutputStream(java.io.FileOutputStream) BufferedOutputStream(java.io.BufferedOutputStream) FileOutputStream(java.io.FileOutputStream) OutputStreamWriter(java.io.OutputStreamWriter) Document(de.pdark.decentxml.Document) BufferedOutputStream(java.io.BufferedOutputStream) XMLWriter(de.pdark.decentxml.XMLWriter) Writer(java.io.Writer) XMLWriter(de.pdark.decentxml.XMLWriter) OutputStreamWriter(java.io.OutputStreamWriter)

Example 3 with XMLWriter

use of de.pdark.decentxml.XMLWriter in project tycho by eclipse.

the class UpdateSite method write.

public static void write(UpdateSite site, File file) throws IOException {
    OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
    Document document = site.document;
    try {
        String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8";
        Writer w = new OutputStreamWriter(os, enc);
        XMLWriter xw = new XMLWriter(w);
        try {
            document.toXML(xw);
        } finally {
            xw.flush();
        }
    } finally {
        IOUtil.close(os);
    }
}
Also used : OutputStream(java.io.OutputStream) FileOutputStream(java.io.FileOutputStream) BufferedOutputStream(java.io.BufferedOutputStream) FileOutputStream(java.io.FileOutputStream) OutputStreamWriter(java.io.OutputStreamWriter) Document(de.pdark.decentxml.Document) BufferedOutputStream(java.io.BufferedOutputStream) XMLWriter(de.pdark.decentxml.XMLWriter) Writer(java.io.Writer) XMLWriter(de.pdark.decentxml.XMLWriter) OutputStreamWriter(java.io.OutputStreamWriter)

Example 4 with XMLWriter

use of de.pdark.decentxml.XMLWriter in project tycho by eclipse.

the class Feature method write.

public static void write(Feature feature, File file, String indent) throws IOException {
    OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
    Document document = feature.document;
    try {
        String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8";
        Writer w = new OutputStreamWriter(os, enc);
        XMLWriter xw = new XMLWriter(w);
        xw.setIndent(indent);
        try {
            document.toXML(xw);
        } finally {
            xw.flush();
        }
    } finally {
        IOUtil.close(os);
    }
}
Also used : OutputStream(java.io.OutputStream) FileOutputStream(java.io.FileOutputStream) BufferedOutputStream(java.io.BufferedOutputStream) FileOutputStream(java.io.FileOutputStream) OutputStreamWriter(java.io.OutputStreamWriter) Document(de.pdark.decentxml.Document) BufferedOutputStream(java.io.BufferedOutputStream) XMLWriter(de.pdark.decentxml.XMLWriter) Writer(java.io.Writer) XMLWriter(de.pdark.decentxml.XMLWriter) OutputStreamWriter(java.io.OutputStreamWriter)

Example 5 with XMLWriter

use of de.pdark.decentxml.XMLWriter in project tycho by eclipse.

the class IU method write.

public static void write(IU iu, File file, String indent) throws IOException {
    OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
    Document document = iu.document;
    try {
        String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8";
        Writer w = new OutputStreamWriter(os, enc);
        XMLWriter xw = new XMLWriter(w);
        xw.setIndent(indent);
        try {
            document.toXML(xw);
        } finally {
            xw.flush();
        }
    } finally {
        IOUtil.close(os);
    }
}
Also used : OutputStream(java.io.OutputStream) FileOutputStream(java.io.FileOutputStream) BufferedOutputStream(java.io.BufferedOutputStream) FileOutputStream(java.io.FileOutputStream) OutputStreamWriter(java.io.OutputStreamWriter) Document(de.pdark.decentxml.Document) BufferedOutputStream(java.io.BufferedOutputStream) XMLWriter(de.pdark.decentxml.XMLWriter) Writer(java.io.Writer) XMLWriter(de.pdark.decentxml.XMLWriter) OutputStreamWriter(java.io.OutputStreamWriter)

Aggregations

XMLWriter (de.pdark.decentxml.XMLWriter)9 OutputStreamWriter (java.io.OutputStreamWriter)7 Writer (java.io.Writer)7 Document (de.pdark.decentxml.Document)6 BufferedOutputStream (java.io.BufferedOutputStream)6 FileOutputStream (java.io.FileOutputStream)6 OutputStream (java.io.OutputStream)6 File (java.io.File)1 FileWriter (java.io.FileWriter)1 StringWriter (java.io.StringWriter)1