Search in sources :

Example 1 with DOMSerializer

use of org.apache.xml.serialize.DOMSerializer in project OpenAM by OpenRock.

the class AMEncryptionProvider method toString.

// converts the element to a string.
private String toString(Element doc) {
    OutputFormat of = new OutputFormat();
    of.setIndenting(true);
    of.setMethod(Method.XML);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DOMSerializer serializer = new XMLSerializer(baos, of);
    try {
        serializer.serialize(doc);
    } catch (IOException ioe) {
        ioe.printStackTrace();
    }
    return (baos.toString());
}
Also used : DOMSerializer(org.apache.xml.serialize.DOMSerializer) XMLSerializer(org.apache.xml.serialize.XMLSerializer) OutputFormat(org.apache.xml.serialize.OutputFormat) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException)

Example 2 with DOMSerializer

use of org.apache.xml.serialize.DOMSerializer in project vcell by virtualcell.

the class DOMUtil method serialize.

public static void serialize(Document document, OutputStream out) throws IOException {
    OutputFormat format = new OutputFormat();
    XMLSerializer serializer = new XMLSerializer(out, format);
    DOMSerializer domSerializer = serializer.asDOMSerializer();
    domSerializer.serialize(document);
}
Also used : XMLSerializer(org.apache.xml.serialize.XMLSerializer) DOMSerializer(org.apache.xml.serialize.DOMSerializer) OutputFormat(org.apache.xml.serialize.OutputFormat)

Aggregations

DOMSerializer (org.apache.xml.serialize.DOMSerializer)2 OutputFormat (org.apache.xml.serialize.OutputFormat)2 XMLSerializer (org.apache.xml.serialize.XMLSerializer)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1