Package org.apache.xml.serializer.dom3
Class LSSerializerImpl
java.lang.Object
org.apache.xml.serializer.dom3.LSSerializerImpl
- All Implemented Interfaces:
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.- Version:
- $Id:
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canSetParameter
(String name, Object value) Checks if setting a parameter to a specific value is supported.Returns the DOMConfiguration of the LSSerializer.This method returns the LSSerializer's error handler.Returns the DOMConfiguration of the LSSerializer.Returns the End-Of-Line sequence of characters to be used in the XML being serialized.getParameter
(String name) This method returns the value of a parameter if known.This method returns a of the parameters supported by this DOMConfiguration object and for which at least one value can be set by the applicationvoid
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
Serializes the specified node to the specified LSOutput and returns true if the Node was successfully serialized.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.
-
Constructor Details
-
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.
-
-
Method Details
-
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. -
canSetParameter
Checks if setting a parameter to a specific value is supported.- Specified by:
canSetParameter
in interfaceDOMConfiguration
- Parameters:
name
- A String containing the DOMConfiguration parameter name.value
- An Object specifying the value of the corresponding parameter.- Since:
- DOM Level 3
- See Also:
-
getParameter
This method returns the value of a parameter if known.- Specified by:
getParameter
in interfaceDOMConfiguration
- Parameters:
name
- A String containing the DOMConfiguration parameter name whose value is to be returned.- Returns:
- Object The value of the parameter if known.
- Throws:
DOMException
- See Also:
-
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- Specified by:
getParameterNames
in interfaceDOMConfiguration
- Returns:
- DOMStringList A list of DOMConfiguration parameters recognized by the serializer
- See Also:
-
setParameter
This method sets the value of the named parameter.- Specified by:
setParameter
in interfaceDOMConfiguration
- Parameters:
name
- A String containing the DOMConfiguration parameter name.value
- An Object contaiing the parameters value to set.- Throws:
DOMException
- See Also:
-
getDomConfig
Returns the DOMConfiguration of the LSSerializer.- Specified by:
getDomConfig
in interfaceLSSerializer
- Returns:
- A DOMConfiguration object.
- Since:
- DOM Level 3
- See Also:
-
getFilter
Returns the DOMConfiguration of the LSSerializer.- Specified by:
getFilter
in interfaceLSSerializer
- Returns:
- A LSSerializerFilter object.
- Since:
- DOM Level 3
- See Also:
-
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.- Specified by:
getNewLine
in interfaceLSSerializer
- Returns:
- A String containing the end-of-line character sequence used in serialization.
- Since:
- DOM Level 3
- See Also:
-
setFilter
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.- Specified by:
setFilter
in interfaceLSSerializer
- Parameters:
filter
- A LSSerializerFilter to be applied to the stream to serialize.- Since:
- DOM Level 3
- See Also:
-
setNewLine
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".- Specified by:
setNewLine
in interfaceLSSerializer
- Parameters:
newLine
- a String that is the end-of-line character sequence to be used in serialization.- Since:
- DOM Level 3
- See Also:
-
write
Serializes the specified node to the specified LSOutput and returns true if the Node was successfully serialized.- Specified by:
write
in interfaceLSSerializer
- Parameters:
nodeArg
- The Node to serialize.- Throws:
LSException
- SERIALIZE_ERR: Raised if the LSSerializer was unable to serialize the node.- Since:
- DOM Level 3
- See Also:
-
writeToString
Serializes the specified node and returns a String with the serialized data to the caller.- Specified by:
writeToString
in interfaceLSSerializer
- Parameters:
nodeArg
- The Node to serialize.- Throws:
LSException
- SERIALIZE_ERR: Raised if the LSSerializer was unable to serialize the node.DOMException
- Since:
- DOM Level 3
- See Also:
-
writeToURI
Serializes the specified node to the specified URI and returns true if the Node was successfully serialized.- Specified by:
writeToURI
in interfaceLSSerializer
- Parameters:
nodeArg
- The Node to serialize.- Throws:
LSException
- SERIALIZE_ERR: Raised if the LSSerializer was unable to serialize the node.- Since:
- DOM Level 3
- See Also:
-
getErrorHandler
This method returns the LSSerializer's error handler.- Returns:
- Returns the fDOMErrorHandler.
-