org.apache.xml.serializer.dom3
Class LSSerializerImpl
java.lang.Object
org.apache.xml.serializer.dom3.LSSerializerImpl
- DOMConfiguration, LSSerializer
public final class LSSerializerImpl
extends java.lang.Object
implements DOMConfiguration, LSSerializer
Implemenatation of DOM Level 3 org.w3c.ls.LSSerializer and
org.w3c.dom.ls.DOMConfiguration. Serialization is achieved by delegating
serialization calls to org.apache.xml.serializer.ToStream
or
one of its derived classes depending on the serialization method, while walking
the DOM in DOM3TreeWalker.
boolean | canSetParameter(String name, Object value) - Checks if setting a parameter to a specific value is supported.
|
DOMConfiguration | getDomConfig() - Returns the DOMConfiguration of the LSSerializer.
|
DOMErrorHandler | getErrorHandler() - This method returns the LSSerializer's error handler.
|
LSSerializerFilter | getFilter() - Returns the DOMConfiguration of the LSSerializer.
|
String | getNewLine() - Returns the End-Of-Line sequence of characters to be used in the XML
being serialized.
|
Object | getParameter(String name) - This method returns the value of a parameter if known.
|
DOMStringList | getParameterNames() - This method returns a of the parameters supported by this DOMConfiguration object
and for which at least one value can be set by the application
|
void | initializeSerializerProps() - Initializes the underlying serializer's configuration depending on the
default DOMConfiguration parameters.
|
void | setFilter(LSSerializerFilter filter) - Set a LSSerilizerFilter on the LSSerializer.
|
void | setNewLine(String newLine) - Sets the End-Of-Line sequence of characters to be used in the XML
being serialized.
|
void | setParameter(String name, Object value) - This method sets the value of the named parameter.
|
boolean | write(Node nodeArg, LSOutput destination) - Serializes the specified node to the specified LSOutput and returns true if the Node
was successfully serialized.
|
String | writeToString(Node nodeArg) - Serializes the specified node and returns a String with the serialized
data to the caller.
|
boolean | writeToURI(Node nodeArg, String uri) - Serializes the specified node to the specified URI and returns true if the Node
was successfully serialized.
|
LSSerializerImpl
public LSSerializerImpl()
Constructor: Creates a LSSerializerImpl object. The underlying
XML 1.0 or XML 1.1 org.apache.xml.serializer.Serializer object is
created and initialized the first time any of the write methods are
invoked to serialize the Node. Subsequent write methods on the same
LSSerializerImpl object will use the previously created Serializer object.
canSetParameter
public boolean canSetParameter(String name,
Object value)
Checks if setting a parameter to a specific value is supported.
name
- A String containing the DOMConfiguration parameter name.value
- An Object specifying the value of the corresponding parameter.
org.w3c.dom.DOMConfiguration.canSetParameter(java.lang.String, java.lang.Object)
getDomConfig
public DOMConfiguration getDomConfig()
Returns the DOMConfiguration of the LSSerializer.
- A DOMConfiguration object.
org.w3c.dom.ls.LSSerializer.getDomConfig()
getErrorHandler
public DOMErrorHandler getErrorHandler()
This method returns the LSSerializer's error handler.
- Returns the fDOMErrorHandler.
getFilter
public LSSerializerFilter getFilter()
Returns the DOMConfiguration of the LSSerializer.
- A LSSerializerFilter object.
org.w3c.dom.ls.LSSerializer.getFilter()
getNewLine
public String getNewLine()
Returns the End-Of-Line sequence of characters to be used in the XML
being serialized. If none is set a default "\n" is returned.
- A String containing the end-of-line character sequence used in
serialization.
org.w3c.dom.ls.LSSerializer.getNewLine()
getParameter
public Object getParameter(String name)
throws DOMException
This method returns the value of a parameter if known.
name
- A String containing the DOMConfiguration parameter name
whose value is to be returned.
- Object The value of the parameter if known.
org.w3c.dom.DOMConfiguration.getParameter(java.lang.String)
getParameterNames
public DOMStringList getParameterNames()
This method returns a of the parameters supported by this DOMConfiguration object
and for which at least one value can be set by the application
- DOMStringList A list of DOMConfiguration parameters recognized
by the serializer
org.w3c.dom.DOMConfiguration.getParameterNames()
initializeSerializerProps
public void initializeSerializerProps()
Initializes the underlying serializer's configuration depending on the
default DOMConfiguration parameters. This method must be called before a
node is to be serialized.
setFilter
public void setFilter(LSSerializerFilter filter)
Set a LSSerilizerFilter on the LSSerializer. When set, the filter is
called before each node is serialized which depending on its implemention
determines if the node is to be serialized or not.
filter
- A LSSerializerFilter to be applied to the stream to serialize.
org.w3c.dom.ls.LSSerializer.setFilter
setNewLine
public void setNewLine(String newLine)
Sets the End-Of-Line sequence of characters to be used in the XML
being serialized. Setting this attribute to null will reset its
value to the default value i.e. "\n".
newLine
- a String that is the end-of-line character sequence to be used in
serialization.
org.w3c.dom.ls.LSSerializer.setNewLine
setParameter
public void setParameter(String name,
Object value)
throws DOMException
This method sets the value of the named parameter.
name
- A String containing the DOMConfiguration parameter name.value
- An Object contaiing the parameters value to set.
org.w3c.dom.DOMConfiguration.setParameter(java.lang.String, java.lang.Object)
write
public boolean write(Node nodeArg,
LSOutput destination)
throws LSException
Serializes the specified node to the specified LSOutput and returns true if the Node
was successfully serialized.
nodeArg
- The Node to serialize.
org.w3c.dom.ls.LSSerializer.write(org.w3c.dom.Node, org.w3c.dom.ls.LSOutput)
writeToString
public String writeToString(Node nodeArg)
throws DOMException,
LSException
Serializes the specified node and returns a String with the serialized
data to the caller.
nodeArg
- The Node to serialize.
org.w3c.dom.ls.LSSerializer.writeToString(org.w3c.dom.Node)
writeToURI
public boolean writeToURI(Node nodeArg,
String uri)
throws LSException
Serializes the specified node to the specified URI and returns true if the Node
was successfully serialized.
nodeArg
- The Node to serialize.
org.w3c.dom.ls.LSSerializer.writeToURI(org.w3c.dom.Node, String)
Copyright B) 2006 Apache XML Project. All Rights Reserved.