public interface SerializationHandler extends ExtendedContentHandler, ExtendedLexicalHandler, DeclHandler, DTDHandler, ErrorHandler, DOMSerializer, Serializer
HTML_ATTREMPTY, HTML_ATTRURL, NO_BAD_CHARS
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flushPending()
A SerializationHandler accepts SAX-like events, so
it can accumulate attributes or namespace nodes after
a startElement().
|
String |
getDoctypePublic()
Returns the previously set value of the value to be used as the public
identifier in the document type declaration (DTD).
|
String |
getDoctypeSystem()
Returns the previously set value of the value to be used
as the system identifier in the document type declaration (DTD).
|
String |
getEncoding() |
boolean |
getIndent() |
int |
getIndentAmount() |
String |
getMediaType() |
boolean |
getOmitXMLDeclaration() |
String |
getOutputProperty(String name)
Get the value for a property that affects seraialization,
if a property was set return that value, otherwise return
the default value, otherwise return null.
|
String |
getOutputPropertyDefault(String name)
Get the default value for a property that affects seraialization,
or null if there is none.
|
String |
getStandalone() |
Transformer |
getTransformer()
Get the transformer associated with the serializer.
|
String |
getVersion() |
void |
serialize(Node node)
Notify that the serializer should take this DOM node as input to be
serialized.
|
void |
setCdataSectionElements(Vector URI_and_localNames)
Sets the value coming from the xsl:output cdata-section-elements
stylesheet property.
|
void |
setContentHandler(ContentHandler ch)
Set the SAX Content handler that the serializer sends its output to.
|
void |
setDoctype(String system,
String pub)
Set the value coming from the xsl:output doctype-public and doctype-system stylesheet properties
|
void |
setDoctypePublic(String doctype)
Set the value coming from the xsl:output doctype-public stylesheet attribute.
|
void |
setDoctypeSystem(String doctype)
Set the value coming from the xsl:output doctype-system stylesheet attribute.
|
void |
setDTDEntityExpansion(boolean expand)
Default behavior is to expand DTD entities,
that is the initall default value is true.
|
void |
setEncoding(String encoding)
Sets the character encoding coming from the xsl:output encoding stylesheet attribute.
|
boolean |
setEscaping(boolean escape)
Turns special character escaping on/off.
|
void |
setIndent(boolean indent)
Sets the value coming from the xsl:output indent stylesheet
attribute.
|
void |
setIndentAmount(int spaces)
Set the number of spaces to indent for each indentation level.
|
void |
setMediaType(String mediatype)
Sets the value coming from the xsl:output media-type stylesheet attribute.
|
void |
setNamespaceMappings(NamespaceMappings mappings)
Used only by TransformerSnapshotImpl to restore the serialization
to a previous state.
|
void |
setOmitXMLDeclaration(boolean b)
Sets the value coming from the xsl:output omit-xml-declaration stylesheet attribute
|
void |
setOutputProperty(String name,
String val)
Set the non-default value for a property that affects seraialization.
|
void |
setOutputPropertyDefault(String name,
String val)
Set the default value for a property that affects seraialization.
|
void |
setStandalone(String standalone)
Sets the value coming from the xsl:output standalone stylesheet attribute.
|
void |
setTransformer(Transformer transformer)
Set the transformer associated with the serializer.
|
void |
setVersion(String version)
Sets the value coming from the xsl:output version attribute.
|
addAttribute, addAttribute, addAttribute, addAttributes, addUniqueAttribute, addXSLAttribute, characters, characters, endElement, entityReference, getNamespaceMappings, getNamespaceURI, getNamespaceURIFromPrefix, getPrefix, namespaceAfterStartElement, setSourceLocator, startElement, startElement, startPrefixMapping
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping
comment
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity
attributeDecl, elementDecl, externalEntityDecl, internalEntityDecl
notationDecl, unparsedEntityDecl
error, fatalError, warning
asContentHandler, asDOM3Serializer, asDOMSerializer, getOutputFormat, getOutputStream, getWriter, reset, setOutputFormat, setOutputStream, setWriter
void setContentHandler(ContentHandler ch)
Serializer.asContentHandler()
,
ToSAXHandler
void close()
void serialize(Node node) throws IOException
serialize
in interface DOMSerializer
node
- the DOM node to be serialized.IOException
boolean setEscaping(boolean escape) throws SAXException
escape
- true if escaping is to be set on.SAXException
void setIndentAmount(int spaces)
spaces
- the number of spaces to indent for each indentation level.void setTransformer(Transformer transformer)
transformer
- the transformer associated with the serializer.Transformer getTransformer()
void setNamespaceMappings(NamespaceMappings mappings)
mappings
- NamespaceMappingsvoid flushPending() throws SAXException
If the SerializationHandler has a Writer or OutputStream, a call to this method will flush such accumulated events as a closed start tag for an element.
If the SerializationHandler wraps a ContentHandler, a call to this method will flush such accumulated events as a SAX (not SAX-like) calls to startPrefixMapping() and startElement().
If one calls endDocument() then one need not call this method since a call to endDocument() will do what this method does. However, in some circumstances, such as with document fragments, endDocument() is not called and it may be necessary to call this method to flush any pending events.
For performance reasons this method should not be called very often.
SAXException
void setDTDEntityExpansion(boolean expand)
expand
- true if DTD entities are to be expanded,
false if they are to be left as DTD entity references.String getDoctypePublic()
String getDoctypeSystem()
String getEncoding()
boolean getIndent()
int getIndentAmount()
String getMediaType()
boolean getOmitXMLDeclaration()
String getStandalone()
standalone
delaration is to
be included in the output document.String getVersion()
void setCdataSectionElements(Vector URI_and_localNames)
URI_and_localNames
- pairs of namespace URI and local names that
identify elements whose text elements are to be output as CDATA sections.
The namespace of the local element must be the given URI to match. The
qName is not given because the prefix does not matter, only the namespace
URI to which that prefix would map matters, so the prefix itself is not
relevant in specifying which elements have their text to be output as
CDATA sections.void setDoctype(String system, String pub)
system
- the system identifier to be used in the DOCTYPE declaration
in the output document.pub
- the public identifier to be used in the DOCTYPE declaration in
the output document.void setDoctypePublic(String doctype)
doctype
- the public identifier to be used in the DOCTYPE
declaration in the output document.void setDoctypeSystem(String doctype)
doctype
- the system identifier to be used in the DOCTYPE
declaration in the output document.void setEncoding(String encoding)
encoding
- the character encodingvoid setIndent(boolean indent)
indent
- true if the output document should be indented to visually
indicate its structure.void setMediaType(String mediatype)
mediatype
- the media-type or MIME type associated with the output
document.void setOmitXMLDeclaration(boolean b)
b
- true if the XML declaration is to be omitted from the output
document.void setStandalone(String standalone)
standalone
- a value of "yes" indicates that the
standalone
delaration is to be included in the output
document.void setVersion(String version)
version
- the version of the output format.String getOutputProperty(String name)
name
- The name of the property, which is just the local name
if it is in no namespace, but is the URI in curly braces followed by
the local name if it is in a namespace, for example:
String getOutputPropertyDefault(String name)
name
- The name of the property.void setOutputProperty(String name, String val)
name
- The name of the property, which is just the local name
if it is in no namespace, but is the URI in curly braces followed by
the local name if it is in a namespace, for example:
void setOutputPropertyDefault(String name, String val)
name
- The name of the property, which is just the local name
if it is in no namespace, but is the URI in curly braces followed by
the local name if it is in a namespace, for example:
Copyright © 2016 JBoss by Red Hat. All rights reserved.