Package org.apache.xml.serializer
Interface DOMSerializer
- All Known Subinterfaces:
SerializationHandler
- All Known Implementing Classes:
SerializerBase,ToHTMLStream,ToSAXHandler,ToStream,ToTextSAXHandler,ToTextStream,ToUnknownStream,ToXMLSAXHandler,ToXMLStream
public interface DOMSerializer
Interface for a DOM serializer implementation.
The DOMSerializer is a facet of a serializer and is obtained from the
asDOMSerializer() method of the (Serializer) interface.
A serializer may or may not support a DOM serializer, if it does not then the
return value from asDOMSerializer() is null.
Example:
// Create a document to be serialized org.w3c.dom.Document doc = ...; // Create a Serializer that will be used // to serialize the document org.apache.xml.serializer.Serializer ser = ...; // Set the Writer to write output to, and // serialize the DOM using that Serializer java.io.StringWriter sw = new java.io.StringWriter(); ser.setWriter(sw); DOMSerialzier dser = ser.asDOMSerializer(); dser.serialize(doc); // Write out the serialized XML in the String. System.out.println(sw.toString());
- See Also:
OutputPropertiesFactory,SerializerFactory,Serializer
-
Method Summary
-
Method Details
-
serialize
Serializes the DOM node. Throws an exception only if an I/O exception occured while serializing. This interface is a public API.- Parameters:
node- the DOM node to serialize- Throws:
IOException- if an I/O exception occured while serializing
-