public class DOMSerializer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private boolean |
namespaceDeclarationAttribute |
private boolean |
parentsNamespaceDeclarationDisabled |
private boolean |
startingDocument |
Constructor and Description |
---|
DOMSerializer() |
Modifier and Type | Method and Description |
---|---|
private void |
characters(org.xml.sax.ContentHandler pHandler,
java.lang.String pValue,
boolean pCdata) |
protected void |
doSerialize(org.w3c.dom.Node pNode,
org.xml.sax.ContentHandler pHandler)
Converts the given node
pNode into a
stream of SAX events, which are fired into the
content handler pHandler . |
protected void |
doSerializeChilds(org.w3c.dom.Node pNode,
org.xml.sax.ContentHandler pHandler)
Serializes the childs of
pNode . |
private void |
endPrefixMappingEvents(org.w3c.dom.Node pNode,
org.xml.sax.ContentHandler pHandler)
Creates endPrefixMapping events for the node
pNode . |
boolean |
isNamespaceDeclarationAttribute()
Returns whether XML declarations are being serialized as
attributes or as SAX events (default).
|
boolean |
isParentsNamespaceDeclarationDisabled()
Sets whether XML declarations present in the parent nodes
are being serialized (default) or not.
|
boolean |
isStartingDocument()
Returns, whether
startDocument and
endDocument events are generated for
document nodes. |
private void |
parentsEndPrefixMappingEvents(org.w3c.dom.Node pNode,
org.xml.sax.ContentHandler pHandler)
Finally creates endPrefixMapping events for the nodes parents.
|
private void |
parentsStartPrefixMappingEvents(org.w3c.dom.Node pNode,
org.xml.sax.ContentHandler pHandler)
Initially creates startPrefixMapping events for the nodes parents.
|
void |
serialize(org.w3c.dom.Node pNode,
org.xml.sax.ContentHandler pHandler)
Converts the given node
pNode into a
stream of SAX events, which are fired into the
content handler pHandler . |
void |
setNamespaceDeclarationAttribute(boolean pXmlDeclarationAttribute)
Sets whether XML namespace declarations are being serialized as
attributes or as SAX events (default).
|
void |
setParentsNamespaceDeclarationDisabled(boolean pParentsXmlDeclarationDisabled)
Returns whether XML declarations present in the parent nodes
are being serialized (default) or not.
|
void |
setStartingDocument(boolean pStartingDocument)
Sets, whether
startDocument and
endDocument events are generated for
document nodes. |
private void |
startPrefixMappingEvents(org.w3c.dom.Node pNode,
org.xml.sax.ContentHandler pHandler)
Creates startPrefixMapping events for the node
pNode . |
private boolean namespaceDeclarationAttribute
private boolean parentsNamespaceDeclarationDisabled
private boolean startingDocument
public void setNamespaceDeclarationAttribute(boolean pXmlDeclarationAttribute)
pXmlDeclarationAttribute
- True, if a namespace declaration
is being transmitted as an XML attribute. False otherwise.public boolean isNamespaceDeclarationAttribute()
public void setParentsNamespaceDeclarationDisabled(boolean pParentsXmlDeclarationDisabled)
namespaceDeclarationAttribute
properts is false.pParentsXmlDeclarationDisabled
- True, if namespace
declarations of the parent nodes are disabled, false otherwise.public boolean isParentsNamespaceDeclarationDisabled()
namespaceDeclarationAttribute
properts is false.public boolean isStartingDocument()
startDocument
and
endDocument
events are generated for
document nodes.startDocument
and
endDocument
events are being generated.
False otherwise.public void setStartingDocument(boolean pStartingDocument)
startDocument
and
endDocument
events are generated for
document nodes.pStartingDocument
- True (default), if
startDocument
and
endDocument
events are being generated.
False otherwise.protected void doSerializeChilds(org.w3c.dom.Node pNode, org.xml.sax.ContentHandler pHandler) throws org.xml.sax.SAXException
pNode
.pNode
- The parent node, whose childs are being serialized.pHandler
- The target handler.org.xml.sax.SAXException
- The target handler reported an error.private void parentsStartPrefixMappingEvents(org.w3c.dom.Node pNode, org.xml.sax.ContentHandler pHandler) throws org.xml.sax.SAXException
isNamespaceDeclarationAttribute()
,
and isParentsNamespaceDeclarationDisabled()
are false.pNode
- The node, for which namespace declarations are being
created.pHandler
- The target handler.org.xml.sax.SAXException
- The target handler reported an error.private void parentsEndPrefixMappingEvents(org.w3c.dom.Node pNode, org.xml.sax.ContentHandler pHandler) throws org.xml.sax.SAXException
isNamespaceDeclarationAttribute()
,
and isParentsNamespaceDeclarationDisabled()
are false.pNode
- The node, for which namespace declarations are being
created.pHandler
- The target handler.org.xml.sax.SAXException
- The target handler reported an error.private void startPrefixMappingEvents(org.w3c.dom.Node pNode, org.xml.sax.ContentHandler pHandler) throws org.xml.sax.SAXException
pNode
.pNode
- The node being serialized.pHandler
- The target handler.org.xml.sax.SAXException
- The target handler reported an error.private void endPrefixMappingEvents(org.w3c.dom.Node pNode, org.xml.sax.ContentHandler pHandler) throws org.xml.sax.SAXException
pNode
.pNode
- The node being serialized.pHandler
- The target handler.org.xml.sax.SAXException
- The target handler reported an error.private void characters(org.xml.sax.ContentHandler pHandler, java.lang.String pValue, boolean pCdata) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public void serialize(org.w3c.dom.Node pNode, org.xml.sax.ContentHandler pHandler) throws org.xml.sax.SAXException
pNode
into a
stream of SAX events, which are fired into the
content handler pHandler
.pNode
- The node being serialized.pHandler
- The target handler.org.xml.sax.SAXException
- The target handler reported an error.protected void doSerialize(org.w3c.dom.Node pNode, org.xml.sax.ContentHandler pHandler) throws org.xml.sax.SAXException
pNode
into a
stream of SAX events, which are fired into the
content handler pHandler
. Unlike
serialize(Node, ContentHandler)
, this method
doesn't call
parentsStartPrefixMappingEvents(Node, ContentHandler)
,
and
parentsEndPrefixMappingEvents(Node, ContentHandler)
.pNode
- The node being serialized.pHandler
- The target handler.org.xml.sax.SAXException
- The target handler reported an error.