Mark Wilson I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :
03/24/2008
Times viewed :
662
Xalan: The org.apache.xml.serializer.Serializer Interface
Sub Interfaces: org.apache.xml.serializer.SerializationHandler
Members
Signature
Public methods
ContentHandler
asContentHandler()
DOMSerializer
asDOMSerializer()
java.util.Properties
getOutputFormat()
java.io.OutputStream
getOutputStream()
java.io.Writer
getWriter()
boolean
reset()
void
setOutputFormat(java.util.Properties
format)
void
setOutputStream(java.io.OutputStream
output)
void
setWriter(java.io.Writer
writer)
Overview
The
Serializer interface is implemented by Serializers to publish methods to get
and set streams and writers, to set the output properties, and get the
Serializer as a ContentHandler or DOMSerializer.
Method Overviews
This
method has important methods to return a ContentHandler interface into this
serializer, return a DOMSerializer interface into this serializer etc. This can
be reused with different configuration by calling reset() method.
Example of creating a Serializer object:
Generally
org.apache.xml.serializer.SerializerFactory is used to create an instance of
Serializer object.
Serializer ser =
SerializerFactory.getSerializer(prop);
In the
above example, I have used created a Properties object using OutputPropertiesFactory.getDefaultMethodProperties("xml").
The I have creates an instance of Serializer instance.
Example of asDOMSerializer():
This
method returns a org.apache.xml.serializer.DOMSerializer interface into this serializer.
If the serializer does not support the DOMSerializer
interface, it should return null.
A DOM
serializer is a facet of a serializer. A serializer may or may not support a
DOM serializer. A DOMserializer is used to Serializes the DOM node. So as I
have mentioned, this class is useful to serialize XML related objects.
Example of asContentHandler():
This
method returns a ContentHandler interface into this serializer. If the
serializer does not support the ContentHandler interface, it should return
null. Before using this menthod ensure that your serializer os SAX2 compliant
otherwise, it will return null.