org.ajax4jsf.xml.serializer
Class ToXMLStream

java.lang.Object
  extended by org.ajax4jsf.xml.serializer.SerializerBase
      extended by org.ajax4jsf.xml.serializer.ToStream
          extended by org.ajax4jsf.xml.serializer.ToXMLStream
All Implemented Interfaces:
DOMSerializer, SerializationHandler, Serializer, org.xml.sax.DTDHandler, org.xml.sax.ErrorHandler, org.xml.sax.ext.DeclHandler

public final class ToXMLStream
extends ToStream

This class converts SAX or SAX-like calls to a serialized xml document. The xsl:output method is "xml". This class is used explicitly in code generated by XSLTC, so it is "public", but it should be viewed as internal or package private, this is not an API.


Field Summary
static java.lang.String CDATA_CONTINUE
          To insert ]]> in a CDATA section by ending the last CDATA section with ]] and starting the next CDATA section with >
static java.lang.String CDATA_DELIMITER_CLOSE
          The constant "]]>"
static java.lang.String CDATA_DELIMITER_OPEN
           
static java.lang.String DEFAULT_SAX_SERIALIZER
           
static java.lang.String EMPTYSTRING
           
static java.lang.String ENTITY_AMP
           
static java.lang.String ENTITY_CRLF
           
static java.lang.String ENTITY_GT
           
static java.lang.String ENTITY_LT
           
static java.lang.String ENTITY_QUOT
           
static int HTML_ATTREMPTY
           
static int HTML_ATTRURL
           
static int NO_BAD_CHARS
           
static java.lang.String XML_PREFIX
           
static java.lang.String XMLNS_PREFIX
           
static java.lang.String XMLNS_URI
           
static java.lang.String XMLVERSION10
           
static java.lang.String XMLVERSION11
          Define the XML version.
 
Fields inherited from class org.ajax4jsf.xml.serializer.ToStream
m_cdataStartCalled, m_charInfo, m_disableOutputEscapingStates, m_format, m_inDoctype, m_ispreserve, m_isprevtext, m_lineSep, m_lineSepLen, m_lineSepUse, m_preserves, m_spaceBeforeClose
 
Fields inherited from class org.ajax4jsf.xml.serializer.SerializerBase
m_attrBuff, m_attributes, m_cdataSectionElements, m_charsBuff, m_doIndent, m_elemContext, m_indentAmount, m_inEntityRef, m_inExternalDTD, m_needToCallStartDocument, m_prefixMap, m_sourceLocator, m_standaloneWasSpecified, m_tracer, m_writer
 
Constructor Summary
ToXMLStream()
          Default constructor.
 
Method Summary
 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 an attribute to the current element.
 void addUniqueAttribute(java.lang.String name, java.lang.String value, int flags)
          This method is used to add an attribute to the currently open element.
 void CopyFrom(ToXMLStream xmlListener)
          Copy properties from another SerializerToXML.
 void endDocument()
          Receive notification of the end of a document.
 void endElement(java.lang.String elemName)
          Receive notification of the end of an element.
 void endPreserving()
          Ends a whitespace preserving section.
 void entityReference(java.lang.String name)
          Receive notivication of a entityReference.
 void namespaceAfterStartElement(java.lang.String prefix, java.lang.String uri)
          This method is used to notify the serializer of a namespace mapping (or node) that applies to the current element whose startElement() call has already been seen.
 void processingInstruction(java.lang.String target, java.lang.String data)
          Receive notification of a processing instruction.
protected  boolean pushNamespace(java.lang.String prefix, java.lang.String uri)
          From XSLTC Declare a prefix to point to a namespace URI.
 boolean reset()
          Try's to reset the super class and reset this class for re-use, so that you don't need to create a new serializer (mostly for performance reasons).
 void startDocumentInternal()
          Receive notification of the beginning of a document.
 void startPreserving()
          Starts a whitespace preserving section.
 
Methods inherited from class org.ajax4jsf.xml.serializer.ToStream
accumDefaultEntity, accumDefaultEscape, addAttributeAlways, attributeDecl, cdata, characters, characters, charactersRaw, closeCDATA, closeStartTag, comment, elementDecl, endCDATA, endDTD, endElement, endNonEscaping, endPrefixMapping, ensureAttributesNamespaceIsDeclared, escapingNotNeeded, externalEntityDecl, firePseudoAttributes, flushPending, flushWriter, getIndentAmount, getOutputFormat, getOutputStream, getWriter, ignorableWhitespace, indent, indent, init, internalEntityDecl, notationDecl, outputLineSep, processAttributes, serialize, setCdataSectionElements, setContentHandler, setDTDEntityExpansion, setEncoding, setEscaping, setIndentAmount, setLineSepUse, setOutputFormat, setOutputStream, setTransformer, setWriter, shouldIndent, skippedEntity, startCDATA, startDTD, startElement, startElement, startElement, startEntity, startNonEscaping, startPrefixMapping, startPrefixMapping, unparsedEntityDecl, writeAttrString, writeUTF16Surrogate
 
Methods inherited from class org.ajax4jsf.xml.serializer.SerializerBase
addAttribute, addAttribute, addAttributes, addXSLAttribute, asContentHandler, asDOMSerializer, characters, close, comment, endEntity, error, fatalError, fireCDATAEvent, fireCharEvent, fireCommentEvent, fireEndDoc, fireEndElem, fireEndEntity, fireEntityReference, fireEscapingEvent, fireStartDoc, fireStartElem, fireStartEntity, getDoctypePublic, getDoctypeSystem, getEncoding, getIndent, getLocalName, getMediaType, getNamespaceMappings, getNamespaceURI, getNamespaceURIFromPrefix, getOmitXMLDeclaration, getPrefix, getPrefixPart, getStandalone, getTransformer, getVersion, initCDATA, isCdataSection, patchName, setDoctype, setDoctypePublic, setDoctypeSystem, setDocumentLocator, setIndent, setMediaType, setNamespaceMappings, setOmitXMLDeclaration, setSourceLocator, setStandalone, setStandaloneInternal, setVersion, startDocument, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_BAD_CHARS

public static final int NO_BAD_CHARS
See Also:
Constant Field Values

HTML_ATTREMPTY

public static final int HTML_ATTREMPTY
See Also:
Constant Field Values

HTML_ATTRURL

public static final int HTML_ATTRURL
See Also:
Constant Field Values

CDATA_CONTINUE

public static final java.lang.String CDATA_CONTINUE
To insert ]]> in a CDATA section by ending the last CDATA section with ]] and starting the next CDATA section with >

See Also:
Constant Field Values

CDATA_DELIMITER_CLOSE

public static final java.lang.String CDATA_DELIMITER_CLOSE
The constant "]]>"

See Also:
Constant Field Values

CDATA_DELIMITER_OPEN

public static final java.lang.String CDATA_DELIMITER_OPEN
See Also:
Constant Field Values

EMPTYSTRING

public static final java.lang.String EMPTYSTRING
See Also:
Constant Field Values

ENTITY_AMP

public static final java.lang.String ENTITY_AMP
See Also:
Constant Field Values

ENTITY_CRLF

public static final java.lang.String ENTITY_CRLF
See Also:
Constant Field Values

ENTITY_GT

public static final java.lang.String ENTITY_GT
See Also:
Constant Field Values

ENTITY_LT

public static final java.lang.String ENTITY_LT
See Also:
Constant Field Values

ENTITY_QUOT

public static final java.lang.String ENTITY_QUOT
See Also:
Constant Field Values

XML_PREFIX

public static final java.lang.String XML_PREFIX
See Also:
Constant Field Values

XMLNS_PREFIX

public static final java.lang.String XMLNS_PREFIX
See Also:
Constant Field Values

XMLNS_URI

public static final java.lang.String XMLNS_URI
See Also:
Constant Field Values

DEFAULT_SAX_SERIALIZER

public static final java.lang.String DEFAULT_SAX_SERIALIZER
See Also:
Constant Field Values

XMLVERSION11

public static final java.lang.String XMLVERSION11
Define the XML version.

See Also:
Constant Field Values

XMLVERSION10

public static final java.lang.String XMLVERSION10
See Also:
Constant Field Values
Constructor Detail

ToXMLStream

public ToXMLStream()
Default constructor.

Method Detail

CopyFrom

public void CopyFrom(ToXMLStream xmlListener)
Copy properties from another SerializerToXML.

Parameters:
xmlListener - non-null reference to a SerializerToXML object.

startDocumentInternal

public void startDocumentInternal()
                           throws org.xml.sax.SAXException
Receive notification of the beginning of a document.

Overrides:
startDocumentInternal in class SerializerBase
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
org.xml.sax.SAXException

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Receive notification of the end of a document.

Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
org.xml.sax.SAXException

startPreserving

public void startPreserving()
                     throws org.xml.sax.SAXException
Starts a whitespace preserving section. All characters printed within a preserving section are printed without indentation and without consolidating multiple spaces. This is equivalent to the xml:space="preserve" attribute. Only XML and HTML serializers need to support this method.

The contents of the whitespace preserving section will be delivered through the regular characters event.

Throws:
org.xml.sax.SAXException

endPreserving

public void endPreserving()
                   throws org.xml.sax.SAXException
Ends a whitespace preserving section.

Throws:
org.xml.sax.SAXException
See Also:
startPreserving()

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
Receive notification of a processing instruction.

Parameters:
target - The processing instruction target.
data - The processing instruction data, or null if none was supplied.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
org.xml.sax.SAXException

entityReference

public void entityReference(java.lang.String name)
                     throws org.xml.sax.SAXException
Receive notivication of a entityReference.

Overrides:
entityReference in class SerializerBase
Parameters:
name - The name of the entity.
Throws:
org.xml.sax.SAXException

addUniqueAttribute

public void addUniqueAttribute(java.lang.String name,
                               java.lang.String value,
                               int flags)
                        throws org.xml.sax.SAXException
This method is used to add an attribute to the currently open element. The caller has guaranted that this attribute is unique, which means that it not been seen before and will not be seen again.

Parameters:
name - the qualified name of the attribute
value - the value of the attribute which can contain only ASCII printable characters characters in the range 32 to 127 inclusive.
flags - the bit values of this integer give optimization information.
Throws:
org.xml.sax.SAXException

addAttribute

public 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 an attribute to the current element.

Overrides:
addAttribute in class SerializerBase
Parameters:
uri - the URI associated with the element name
localName - local part of the attribute name
rawName - prefix:localName
type -
value - the value of the attribute
xslAttribute - true if this attribute is from an xsl:attribute, false if declared within the elements opening tag.
Throws:
org.xml.sax.SAXException
See Also:
ExtendedContentHandler.addAttribute(String, String, String, String, String)

endElement

public void endElement(java.lang.String elemName)
                throws org.xml.sax.SAXException
Description copied from class: ToStream
Receive notification of the end of an element.

Overrides:
endElement in class ToStream
Parameters:
elemName - The element type name
Throws:
org.xml.sax.SAXException
See Also:
ExtendedContentHandler.endElement(String)

namespaceAfterStartElement

public void namespaceAfterStartElement(java.lang.String prefix,
                                       java.lang.String uri)
                                throws org.xml.sax.SAXException
This method is used to notify the serializer of a namespace mapping (or node) that applies to the current element whose startElement() call has already been seen. The official SAX startPrefixMapping(prefix,uri) is to define a mapping for a child element that is soon to be seen with a startElement() call. The official SAX call does not apply to the current element, hence the reason for this method.

Overrides:
namespaceAfterStartElement in class SerializerBase
Parameters:
prefix - the URI of the namespace
uri - the prefix associated with the given URI.
Throws:
org.xml.sax.SAXException
See Also:
ExtendedContentHandler.namespaceAfterStartElement(String, String)

pushNamespace

protected boolean pushNamespace(java.lang.String prefix,
                                java.lang.String uri)
From XSLTC Declare a prefix to point to a namespace URI. Inform SAX handler if this is a new prefix mapping.


reset

public boolean reset()
Try's to reset the super class and reset this class for re-use, so that you don't need to create a new serializer (mostly for performance reasons).

Specified by:
reset in interface Serializer
Overrides:
reset in class ToStream
Returns:
true if the class was successfuly reset.


Copyright © 2010. All Rights Reserved.