org.ajax4jsf.xml.serializer
Interface SerializationHandler

All Superinterfaces:
org.xml.sax.ext.DeclHandler, DOMSerializer, org.xml.sax.DTDHandler, org.xml.sax.ErrorHandler, Serializer
All Known Implementing Classes:
EmptySerializer, SerializerBase, ToHTMLSAXHandler, ToHTMLStream, ToSAXHandler, ToStream, ToTextSAXHandler, ToTextStream, ToUnknownStream, ToXHTMLStream, ToXMLSAXHandler, ToXMLStream

public interface SerializationHandler
extends org.xml.sax.ext.DeclHandler, org.xml.sax.DTDHandler, org.xml.sax.ErrorHandler, DOMSerializer, Serializer

This interface is the one that a serializer implements. It is a group of other interfaces, such as ExtendedContentHandler, ExtendedLexicalHandler etc. In addition there are other methods, such as reset(). This class is public only because it is used in another package, it is not a public API.


Field Summary
static int HTML_ATTREMPTY
           
static int HTML_ATTRURL
           
static int NO_BAD_CHARS
           
 
Method Summary
 void addAttribute(java.lang.String qName, java.lang.String value)
          Add an attribute to the current element.
 void addAttribute(java.lang.String uri, java.lang.String localName, java.lang.String rawName, java.lang.String type, java.lang.String value)
          Add at attribute to the current element, not from an xsl:attribute element.
 void addAttribute(java.lang.String uri, java.lang.String localName, java.lang.String rawName, java.lang.String type, java.lang.String value, boolean XSLAttribute)
          Add at attribute to the current element
 void addAttributes(org.xml.sax.Attributes atts)
          Add attributes to the current element
 void addUniqueAttribute(java.lang.String qName, java.lang.String value, int flags)
          Add a unique attribute to the current element.
 void addXSLAttribute(java.lang.String qName, java.lang.String value, java.lang.String uri)
          Add an attribute from an xsl:attribute element.
 void characters(org.w3c.dom.Node node)
          This method is used to notify of a character event, but passing the data as a DOM Node rather than the standard character array.
 void characters(java.lang.String chars)
          This method is used to notify of a character event, but passing the data as a character String rather than the standard character array.
 void close()
           
 void comment(java.lang.String comment)
          This method is used to notify of a comment
 void endElement(java.lang.String elemName)
          This method is used to notify that an element has ended.
 void entityReference(java.lang.String entityName)
          Notify of an entity reference.
 void flushPending()
          Flush any pending events currently queued up in the serializer.
 java.lang.String getDoctypePublic()
          Returns the previously set value of the value to be used as the public identifier in the document type declaration (DTD).
 java.lang.String getDoctypeSystem()
          Returns the previously set value of the value to be used as the system identifier in the document type declaration (DTD).
 java.lang.String getEncoding()
           
 boolean getIndent()
           
 int getIndentAmount()
           
 java.lang.String getMediaType()
           
 NamespaceMappings getNamespaceMappings()
          This method returns an object that has the current namespace mappings in effect.
 java.lang.String getNamespaceURI(java.lang.String name, boolean isElement)
          This method gets the prefix associated with a current element or attribute name.
 java.lang.String getNamespaceURIFromPrefix(java.lang.String prefix)
          This method returns the namespace URI currently associated with the prefix.
 boolean getOmitXMLDeclaration()
           
 java.lang.String getPrefix(java.lang.String uri)
          This method returns the prefix that currently maps to the given namespace URI.
 java.lang.String getStandalone()
           
 javax.xml.transform.Transformer getTransformer()
          Get the transformer associated with the serializer.
 java.lang.String getVersion()
           
 void namespaceAfterStartElement(java.lang.String uri, java.lang.String prefix)
          This method is used to notify that a prefix mapping is to start, but after an element is started.
 void serialize(org.w3c.dom.Node node)
          Notify that the serializer should take this DOM node as input to be serialized.
 void setCdataSectionElements(java.util.Vector URI_and_localNames)
          Sets the value coming from the xsl:output cdata-section-elements stylesheet property.
 void setContentHandler(org.xml.sax.ContentHandler ch)
          Set the SAX Content handler that the serializer sends its output to.
 void setDoctype(java.lang.String system, java.lang.String pub)
          Set the value coming from the xsl:output doctype-public and doctype-system stylesheet properties
 void setDoctypePublic(java.lang.String doctype)
          Set the value coming from the xsl:output doctype-public stylesheet attribute.
 void setDoctypeSystem(java.lang.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(java.lang.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(java.lang.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 setSourceLocator(javax.xml.transform.SourceLocator locator)
          This method is used to set the source locator, which might be used to generated an error message.
 void setStandalone(java.lang.String standalone)
          Sets the value coming from the xsl:output standalone stylesheet attribute.
 void setTransformer(javax.xml.transform.Transformer transformer)
          Set the transformer associated with the serializer.
 void setVersion(java.lang.String version)
          Sets the value coming from the xsl:output version attribute.
 void startElement(java.lang.String qName)
          This method is used to notify of the start of an element
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
          This method is used to notify that an element is starting.
 boolean startPrefixMapping(java.lang.String prefix, java.lang.String uri, boolean shouldFlush)
          This method is used to notify that a prefix maping is to start, which can be for the current element, or for the one to come.
 
Methods inherited from interface org.xml.sax.ContentHandler
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping
 
Methods inherited from interface org.xml.sax.ext.LexicalHandler
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity
 
Methods inherited from interface org.xml.sax.ext.DeclHandler
attributeDecl, elementDecl, externalEntityDecl, internalEntityDecl
 
Methods inherited from interface org.xml.sax.DTDHandler
notationDecl, unparsedEntityDecl
 
Methods inherited from interface org.xml.sax.ErrorHandler
error, fatalError, warning
 
Methods inherited from interface org.ajax4jsf.xml.serializer.Serializer
asContentHandler, asDOMSerializer, getOutputFormat, getOutputStream, getWriter, reset, setOutputFormat, setOutputStream, setWriter
 

Field Detail

NO_BAD_CHARS

static final int NO_BAD_CHARS
See Also:
Constant Field Values

HTML_ATTREMPTY

static final int HTML_ATTREMPTY
See Also:
Constant Field Values

HTML_ATTRURL

static final int HTML_ATTRURL
See Also:
Constant Field Values
Method Detail

setContentHandler

void setContentHandler(org.xml.sax.ContentHandler ch)
Set the SAX Content handler that the serializer sends its output to. This method only applies to a ToSAXHandler, not to a ToStream serializer.

See Also:
Serializer.asContentHandler(), ToSAXHandler

close

void close()

serialize

void serialize(org.w3c.dom.Node node)
               throws java.io.IOException
Notify that the serializer should take this DOM node as input to be serialized.

Specified by:
serialize in interface DOMSerializer
Parameters:
node - the DOM node to be serialized.
Throws:
java.io.IOException

setEscaping

boolean setEscaping(boolean escape)
                    throws org.xml.sax.SAXException
Turns special character escaping on/off. Note that characters will never, even if this option is set to 'true', be escaped within CDATA sections in output XML documents.

Parameters:
escape - true if escaping is to be set on.
Throws:
org.xml.sax.SAXException

setIndentAmount

void setIndentAmount(int spaces)
Set the number of spaces to indent for each indentation level.

Parameters:
spaces - the number of spaces to indent for each indentation level.

setTransformer

void setTransformer(javax.xml.transform.Transformer transformer)
Set the transformer associated with the serializer.

Parameters:
transformer - the transformer associated with the serializer.

getTransformer

javax.xml.transform.Transformer getTransformer()
Get the transformer associated with the serializer.

Returns:
Transformer the transformer associated with the serializer.

setNamespaceMappings

void setNamespaceMappings(NamespaceMappings mappings)
Used only by TransformerSnapshotImpl to restore the serialization to a previous state.

Parameters:
mappings - NamespaceMappings

flushPending

void flushPending()
                  throws org.xml.sax.SAXException
Flush any pending events currently queued up in the serializer. This will flush any input that the serializer has which it has not yet sent as output.

Throws:
org.xml.sax.SAXException

setDTDEntityExpansion

void setDTDEntityExpansion(boolean expand)
Default behavior is to expand DTD entities, that is the initall default value is true.

Parameters:
expand - true if DTD entities are to be expanded, false if they are to be left as DTD entity references.

addAttribute

void addAttribute(java.lang.String uri,
                  java.lang.String localName,
                  java.lang.String rawName,
                  java.lang.String type,
                  java.lang.String value,
                  boolean XSLAttribute)
                  throws org.xml.sax.SAXException
Add at attribute to the current element

Parameters:
uri - the namespace URI of the attribute name
localName - the local name of the attribute (without prefix)
rawName - the qualified name of the attribute
type - the attribute type typically character data (CDATA)
value - the value of the attribute
XSLAttribute - true if the added attribute is coming from an xsl:attribute element
Throws:
org.xml.sax.SAXException

addAttributes

void addAttributes(org.xml.sax.Attributes atts)
                   throws org.xml.sax.SAXException
Add attributes to the current element

Parameters:
atts - the attributes to add.
Throws:
org.xml.sax.SAXException

addAttribute

void addAttribute(java.lang.String qName,
                  java.lang.String value)
Add an attribute to the current element. The namespace URI of the attribute will be calculated from the prefix of qName. The local name will be derived from qName and the type will be assumed to be "CDATA".

Parameters:
qName -
value -

characters

void characters(java.lang.String chars)
                throws org.xml.sax.SAXException
This method is used to notify of a character event, but passing the data as a character String rather than the standard character array.

Parameters:
chars - the character data
Throws:
org.xml.sax.SAXException

characters

void characters(org.w3c.dom.Node node)
                throws org.xml.sax.SAXException
This method is used to notify of a character event, but passing the data as a DOM Node rather than the standard character array.

Parameters:
node - a DOM Node containing text.
Throws:
org.xml.sax.SAXException

endElement

void endElement(java.lang.String elemName)
                throws org.xml.sax.SAXException
This method is used to notify that an element has ended. Unlike the standard SAX method
 endElement(namespaceURI,localName,qName)
 
only the last parameter is passed. If needed the serializer can derive the localName from the qualified name and derive the namespaceURI from its implementation.

Parameters:
elemName - the fully qualified element name.
Throws:
org.xml.sax.SAXException

startElement

void startElement(java.lang.String uri,
                  java.lang.String localName,
                  java.lang.String qName)
                  throws org.xml.sax.SAXException
This method is used to notify that an element is starting. This method is just like the standard SAX method
 startElement(uri,localName,qname,atts)
 
but without the attributes.

Parameters:
uri - the namespace URI of the element
localName - the local name (without prefix) of the element
qName - the qualified name of the element
Throws:
org.xml.sax.SAXException

startElement

void startElement(java.lang.String qName)
                  throws org.xml.sax.SAXException
This method is used to notify of the start of an element

Parameters:
qName - the fully qualified name of the element
Throws:
org.xml.sax.SAXException

namespaceAfterStartElement

void namespaceAfterStartElement(java.lang.String uri,
                                java.lang.String prefix)
                                throws org.xml.sax.SAXException
This method is used to notify that a prefix mapping is to start, but after an element is started. The SAX method call
 startPrefixMapping(prefix,uri)
 
is used just before an element starts and applies to the element to come, not to the current element. This method applies to the current element. For example one could make the calls in this order:
 startElement("prfx8:elem9")
 namespaceAfterStartElement("http://namespace8","prfx8")
 

Parameters:
uri - the namespace URI being declared
prefix - the prefix that maps to the given namespace
Throws:
org.xml.sax.SAXException

startPrefixMapping

boolean startPrefixMapping(java.lang.String prefix,
                           java.lang.String uri,
                           boolean shouldFlush)
                           throws org.xml.sax.SAXException
This method is used to notify that a prefix maping is to start, which can be for the current element, or for the one to come.

Parameters:
prefix - the prefix that maps to the given URI
uri - the namespace URI of the given prefix
shouldFlush - if true this call is like the SAX startPrefixMapping(prefix,uri) call and the mapping applies to the element to come. If false the mapping applies to the current element.
Returns:
boolean false if the prefix mapping was already in effect (in other words we are just re-declaring), true if this is a new, never before seen mapping for the element.
Throws:
org.xml.sax.SAXException

entityReference

void entityReference(java.lang.String entityName)
                     throws org.xml.sax.SAXException
Notify of an entity reference.

Parameters:
entityName - the name of the entity
Throws:
org.xml.sax.SAXException

getNamespaceMappings

NamespaceMappings getNamespaceMappings()
This method returns an object that has the current namespace mappings in effect.

Returns:
NamespaceMappings an object that has the current namespace mappings in effect.

getPrefix

java.lang.String getPrefix(java.lang.String uri)
This method returns the prefix that currently maps to the given namespace URI.

Parameters:
uri - the namespace URI
Returns:
String the prefix that currently maps to the given URI.

getNamespaceURI

java.lang.String getNamespaceURI(java.lang.String name,
                                 boolean isElement)
This method gets the prefix associated with a current element or attribute name.

Parameters:
name - the qualified name of an element, or attribute
isElement - true if it is an element name, false if it is an atttribute name
Returns:
String the namespace URI associated with the element or attribute.

getNamespaceURIFromPrefix

java.lang.String getNamespaceURIFromPrefix(java.lang.String prefix)
This method returns the namespace URI currently associated with the prefix.

Parameters:
prefix - a prefix of an element or attribute.
Returns:
String the namespace URI currently associated with the prefix.

setSourceLocator

void setSourceLocator(javax.xml.transform.SourceLocator locator)
This method is used to set the source locator, which might be used to generated an error message.

Parameters:
locator - the source locator

addUniqueAttribute

void addUniqueAttribute(java.lang.String qName,
                        java.lang.String value,
                        int flags)
                        throws org.xml.sax.SAXException
Add a unique attribute to the current element. The attribute is guaranteed to be unique here. The serializer can write it out immediately without saving it in a table first. The integer flag contains information about the attribute, which helps the serializer to decide whether a particular processing is needed.

Parameters:
qName - the fully qualified attribute name.
value - the attribute value
flags - a bitwise flag
Throws:
org.xml.sax.SAXException

addXSLAttribute

void addXSLAttribute(java.lang.String qName,
                     java.lang.String value,
                     java.lang.String uri)
Add an attribute from an xsl:attribute element.

Parameters:
qName - the qualified attribute name (prefix:localName)
value - the attributes value
uri - the uri that the prefix of the qName is mapped to.

addAttribute

void addAttribute(java.lang.String uri,
                  java.lang.String localName,
                  java.lang.String rawName,
                  java.lang.String type,
                  java.lang.String value)
                  throws org.xml.sax.SAXException
Add at attribute to the current element, not from an xsl:attribute element.

Parameters:
uri - the namespace URI of the attribute name
localName - the local name of the attribute (without prefix)
rawName - the qualified name of the attribute
type - the attribute type typically character data (CDATA)
value - the value of the attribute
Throws:
org.xml.sax.SAXException

comment

void comment(java.lang.String comment)
             throws org.xml.sax.SAXException
This method is used to notify of a comment

Parameters:
comment - the comment, but unlike the SAX comment() method this method takes a String rather than a character array.
Throws:
org.xml.sax.SAXException

getDoctypePublic

java.lang.String getDoctypePublic()
Returns the previously set value of the value to be used as the public identifier in the document type declaration (DTD).

Returns:
the public identifier to be used in the DOCTYPE declaration in the output document.

getDoctypeSystem

java.lang.String getDoctypeSystem()
Returns the previously set value of the value to be used as the system identifier in the document type declaration (DTD).

Returns:
the system identifier to be used in the DOCTYPE declaration in the output document.

getEncoding

java.lang.String getEncoding()
Returns:
the character encoding to be used in the output document.

getIndent

boolean getIndent()
Returns:
true if the output document should be indented to visually indicate its structure.

getIndentAmount

int getIndentAmount()
Returns:
the number of spaces to indent for each indentation level.

getMediaType

java.lang.String getMediaType()
Returns:
the mediatype the media-type or MIME type associated with the output document.

getOmitXMLDeclaration

boolean getOmitXMLDeclaration()
Returns:
true if the XML declaration is to be omitted from the output document.

getStandalone

java.lang.String getStandalone()
Returns:
a value of "yes" if the standalone delaration is to be included in the output document.

getVersion

java.lang.String getVersion()
Returns:
the version of the output format.

setCdataSectionElements

void setCdataSectionElements(java.util.Vector URI_and_localNames)
Sets the value coming from the xsl:output cdata-section-elements stylesheet property. This sets the elements whose text elements are to be output as CDATA sections.

Parameters:
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.

setDoctype

void setDoctype(java.lang.String system,
                java.lang.String pub)
Set the value coming from the xsl:output doctype-public and doctype-system stylesheet properties

Parameters:
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.

setDoctypePublic

void setDoctypePublic(java.lang.String doctype)
Set the value coming from the xsl:output doctype-public stylesheet attribute.

Parameters:
doctype - the public identifier to be used in the DOCTYPE declaration in the output document.

setDoctypeSystem

void setDoctypeSystem(java.lang.String doctype)
Set the value coming from the xsl:output doctype-system stylesheet attribute.

Parameters:
doctype - the system identifier to be used in the DOCTYPE declaration in the output document.

setEncoding

void setEncoding(java.lang.String encoding)
Sets the character encoding coming from the xsl:output encoding stylesheet attribute.

Parameters:
encoding - the character encoding

setIndent

void setIndent(boolean indent)
Sets the value coming from the xsl:output indent stylesheet attribute.

Parameters:
indent - true if the output document should be indented to visually indicate its structure.

setMediaType

void setMediaType(java.lang.String mediatype)
Sets the value coming from the xsl:output media-type stylesheet attribute.

Parameters:
mediatype - the media-type or MIME type associated with the output document.

setOmitXMLDeclaration

void setOmitXMLDeclaration(boolean b)
Sets the value coming from the xsl:output omit-xml-declaration stylesheet attribute

Parameters:
b - true if the XML declaration is to be omitted from the output document.

setStandalone

void setStandalone(java.lang.String standalone)
Sets the value coming from the xsl:output standalone stylesheet attribute.

Parameters:
standalone - a value of "yes" indicates that the standalone delaration is to be included in the output document.

setVersion

void setVersion(java.lang.String version)
Sets the value coming from the xsl:output version attribute.

Parameters:
version - the version of the output format.


Copyright © 2010. All Rights Reserved.