Top Description Fields Constructors Methods
com.sun.org.apache.xml.internal.serializer

public final Class ToXMLStream

extends ToStream
Class Inheritance
Imports
java.io.IOException, javax.xml.transform.ErrorListener, .Result, .Transformer, .TransformerException, com.sun.org.apache.xml.internal.serializer.utils.MsgKey, .Utils, org.xml.sax.SAXException

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

Modifier and TypeField and Description
pack-priv boolean
m_cdataTagOpen

Hides com.sun.org.apache.xml.internal.serializer.SerializerBase.m_cdataTagOpen.

remembers if we need to write out "]]>" to close the CDATA
private static CharInfo
m_xmlcharInfo

Map that tells which XML characters should have special treatment, and it provides character to entity name lookup.

Inherited from com.sun.org.apache.xml.internal.serializer.ToStream:
m_canConvertMethm_cdataStartCalledm_charactersBufferm_charInfom_charToByteConverterm_childNodeNumm_childNodeNumStackm_disableOutputEscapingStatesm_encodingInfom_inDoctypem_ispreserveSpacem_isprevtextm_isUTF8m_lineSepm_lineSepLenm_lineSepUsem_maxCharacterm_outputStreamm_preserveSpacesm_shouldFlushm_spaceBeforeClosem_startNewLinem_triedToGetConverter

Constructor Summary

AccessConstructor and Description
public
ToXMLStream()

Default constructor.

public
ToXMLStream(ErrorListener l)

Default constructor.

Method Summary

Modifier and TypeMethod and Description
public void
addAttribute(String
the URI associated with the element name
uri
,
String
local part of the attribute name
localName
,
String
prefix:localName
rawName
,
String type, String
the value of the attribute
value
,
boolean
true if this attribute is from an xsl:attribute, false if declared within the elements opening tag.
xslAttribute
)

Overrides com.sun.org.apache.xml.internal.serializer.SerializerBase.addAttribute.

Implements com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler.addAttribute.

Add an attribute to the current element.
public void
addUniqueAttribute(String
the qualified name of the attribute
name
,
String
the value of the attribute which can contain only ASCII printable characters characters in the range 32 to 127 inclusive.
value
,
int
the bit values of this integer give optimization information.
flags
)

Implements com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler.addUniqueAttribute.

This method is used to add an attribute to the currently open element.
public void
CopyFrom(ToXMLStream
non-null reference to a SerializerToXML object.
xmlListener
)

Copy properties from another SerializerToXML.

public void
endDocument()

Implements org.xml.sax.ContentHandler.endDocument.

Receive notification of the end of a document.
public void
endElement(String
The element type name
elemName
)

Overrides com.sun.org.apache.xml.internal.serializer.ToStream.endElement.

Implements com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler.endElement.

Receive notification of the end of an element.
public void
endPreserving()

Ends a whitespace preserving section.

public void
private String

Returns:

string (XML version)
getXMLVersion
()

This method checks for the XML version of output document.

public void
namespaceAfterStartElement(final String
the URI of the namespace
prefix
,
final String
the prefix associated with the given URI.
uri
)

Overrides com.sun.org.apache.xml.internal.serializer.SerializerBase.namespaceAfterStartElement.

Implements com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler.namespaceAfterStartElement.

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.
public void
processingInstruction(String
The processing instruction target.
target
,
String
The processing instruction data, or null if none was supplied.
data
)

Implements org.xml.sax.ContentHandler.processingInstruction.

Receive notification of a processing instruction.
protected boolean
pushNamespace(String prefix, String uri)

From XSLTC Declare a prefix to point to a namespace URI.

public boolean

Returns:

true if the class was successfuly reset.
reset
()

Overrides com.sun.org.apache.xml.internal.serializer.ToStream.reset.

Implements com.sun.org.apache.xml.internal.serializer.Serializer.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).
private void
resetToXMLStream()

Reset all of the fields owned by ToStream class

public void
startDocumentInternal()

Overrides com.sun.org.apache.xml.internal.serializer.SerializerBase.startDocumentInternal.

Receive notification of the beginning of a document.
public void
startPreserving()

Starts a whitespace preserving section.

Inherited from com.sun.org.apache.xml.internal.serializer.ToStream:
accumDefaultEntityaccumDefaultEscapeaddAttributeAlwaysaddCdataSectionElementsattributeDeclcdatacharacterscharacterscharactersRawcloseCDATAcloseStartTagcommentelementDeclendCDATAendDTDendElementendNonEscapingendPrefixMappingensureAttributesNamespaceIsDeclaredensurePrefixIsDeclaredescapingNotNeededexternalEntityDeclfirePseudoAttributesflushCharactersBufferflushPendingflushWritergetIndentgetIndentAmountgetOutputFormatgetOutputStreamgetWriterignorableWhitespaceindentindentinternalEntityDeclisUTF16SurrogatenotationDecloutputDocTypeDecloutputEntityDecloutputLineSepprocessAttributesserializesetCdataSectionElementssetContentHandlersetDTDEntityExpansionsetEncodingsetEscapingsetIndentAmountsetLineSepUsesetOutputFormatsetOutputStreamsetPropsetTransformersetWritershouldFormatOutputshouldIndentshouldIndentForTextskippedEntitystartCDATAstartDTDstartElementstartElementstartElementstartEntitystartNonEscapingstartPrefixMappingstartPrefixMappingunparsedEntityDeclwriteAttrStringwriteNormalizedCharswriteUTF16Surrogate

Field Detail

m_cdataTagOpenback to summary
pack-priv boolean m_cdataTagOpen

Hides com.sun.org.apache.xml.internal.serializer.SerializerBase.m_cdataTagOpen.

remembers if we need to write out "]]>" to close the CDATA

m_xmlcharInfoback to summary
private static CharInfo m_xmlcharInfo

Map that tells which XML characters should have special treatment, and it provides character to entity name lookup.

Constructor Detail

ToXMLStreamback to summary
public ToXMLStream()

Default constructor.

ToXMLStreamback to summary
public ToXMLStream(ErrorListener l)

Default constructor.

Method Detail

addAttributeback to summary
public void addAttribute(String uri, String localName, String rawName, String type, String value, boolean xslAttribute) throws SAXException

Overrides com.sun.org.apache.xml.internal.serializer.SerializerBase.addAttribute.

Implements com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler.addAttribute.

Add an attribute to the current element.

Parameters
uri:String

the URI associated with the element name

localName:String

local part of the attribute name

rawName:String

prefix:localName

value:String

the value of the attribute

xslAttribute:boolean

true if this attribute is from an xsl:attribute, false if declared within the elements opening tag.

addUniqueAttributeback to summary
public void addUniqueAttribute(String name, String value, int flags) throws SAXException

Implements com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler.addUniqueAttribute.

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:String

the qualified name of the attribute

value:String

the value of the attribute which can contain only ASCII printable characters characters in the range 32 to 127 inclusive.

flags:int

the bit values of this integer give optimization information.

CopyFromback to summary
public void CopyFrom(ToXMLStream xmlListener)

Copy properties from another SerializerToXML.

Parameters
xmlListener:ToXMLStream

non-null reference to a SerializerToXML object.

endDocumentback to summary
public void endDocument() throws SAXException

Implements org.xml.sax.ContentHandler.endDocument.

Receive notification of the end of a document.

Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.
endElementback to summary
public void endElement(String elemName) throws SAXException

Overrides com.sun.org.apache.xml.internal.serializer.ToStream.endElement.

Implements com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler.endElement.

Doc from com.sun.org.apache.xml.internal.serializer.ToStream.endElement.

Receive notification of the end of an element.

Parameters
elemName:String

The element type name

Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.
See Also
ExtendedContentHandler#endElement(String)
endPreservingback to summary
public void endPreserving() throws SAXException

Ends a whitespace preserving section.

See Also
startPreserving
entityReferenceback to summary
public void entityReference(String name) throws SAXException

Overrides com.sun.org.apache.xml.internal.serializer.SerializerBase.entityReference.

Implements com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler.entityReference.

Receive notivication of a entityReference.

Parameters
name:String

The name of the entity.

getXMLVersionback to summary
private String getXMLVersion()

This method checks for the XML version of output document. If XML version of output document is not specified, then output document is of version XML 1.0. If XML version of output doucment is specified, but it is not either XML 1.0 or XML 1.1, a warning message is generated, the XML Version of output document is set to XML 1.0 and processing continues.

Returns:String

string (XML version)

namespaceAfterStartElementback to summary
public void namespaceAfterStartElement(final String prefix, final String uri) throws SAXException

Overrides com.sun.org.apache.xml.internal.serializer.SerializerBase.namespaceAfterStartElement.

Implements com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler.namespaceAfterStartElement.

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.

Parameters
prefix:String

Doc from com.sun.org.apache.xml.internal.serializer.SerializerBase.namespaceAfterStartElement.

the URI of the namespace

uri:String

Doc from com.sun.org.apache.xml.internal.serializer.SerializerBase.namespaceAfterStartElement.

the prefix associated with the given URI.

processingInstructionback to summary
public void processingInstruction(String target, String data) throws SAXException

Implements org.xml.sax.ContentHandler.processingInstruction.

Receive notification of a processing instruction.

Parameters
target:String

The processing instruction target.

data:String

The processing instruction data, or null if none was supplied.

Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.
pushNamespaceback to summary
protected boolean pushNamespace(String prefix, String uri)

From XSLTC Declare a prefix to point to a namespace URI. Inform SAX handler if this is a new prefix mapping.

resetback to summary
public boolean reset()

Overrides com.sun.org.apache.xml.internal.serializer.ToStream.reset.

Implements com.sun.org.apache.xml.internal.serializer.Serializer.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).

Returns:boolean

true if the class was successfuly reset.

resetToXMLStreamback to summary
private void resetToXMLStream()

Reset all of the fields owned by ToStream class

startDocumentInternalback to summary
public void startDocumentInternal() throws SAXException

Overrides com.sun.org.apache.xml.internal.serializer.SerializerBase.startDocumentInternal.

Receive notification of the beginning of a document.

Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.
startPreservingback to summary
public void startPreserving() throws 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.