org.apache.xml.serializer
Class ToXMLStream

java.lang.Object
  extended byorg.apache.xml.serializer.SerializerBase
      extended byorg.apache.xml.serializer.ToStream
          extended byorg.apache.xml.serializer.ToXMLStream
All Implemented Interfaces:
ContentHandler, DeclHandler, DOM2DTM.CharacterNodeHandler, DOMSerializer, ErrorHandler, ExtendedContentHandler, ExtendedLexicalHandler, LexicalHandler, SerializationHandler, Serializer, SerializerConstants, XSLOutputAttributes

public class ToXMLStream
extends ToStream

Author:
Santiago Pericas-Geertsen, G. Todd Miller

Field Summary
 
Fields inherited from interface org.apache.xml.serializer.ExtendedContentHandler
HTML_ATTREMPTY, HTML_ATTRURL, NO_BAD_CHARS
 
Fields inherited from interface org.apache.xml.serializer.SerializerConstants
BEGCDATA, CDATA_CONTINUE, CDATA_DELIMITER_CLOSE, CDATA_DELIMITER_OPEN, CNTCDATA, DEFAULT_SAX_SERIALIZER, EMPTYSTRING, ENDCDATA, ENTITY_AMP, ENTITY_CRLF, ENTITY_GT, ENTITY_LT, ENTITY_QUOT, XML_PREFIX, XMLNS_PREFIX, XMLNS_URI
 
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)
          Adds the given attribute to the set of collected attributes , but only if there is a currently open 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)
          From XSLTC Related to startPrefixMapping ???
 void processingInstruction(java.lang.String target, java.lang.String data)
          Receive notification of a processing instruction.
 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.apache.xml.serializer.ToStream
addAttributeAlways, attributeDecl, characters, characters, comment, elementDecl, endCDATA, endDTD, endElement, endNonEscaping, endPrefixMapping, externalEntityDecl, flushPending, getIndentAmount, getOutputFormat, getOutputStream, getWriter, ignorableWhitespace, internalEntityDecl, processAttributes, serialize, setCdataSectionElements, setContentHandler, setEscaping, setIndentAmount, setLineSepUse, setOutputFormat, setOutputStream, setTransformer, setWriter, skippedEntity, startCDATA, startDTD, startElement, startElement, startElement, startEntity, startNonEscaping, startPrefixMapping, startPrefixMapping, writeAttrString
 
Methods inherited from class org.apache.xml.serializer.SerializerBase
addAttribute, addAttributes, asContentHandler, asDOMSerializer, characters, close, comment, endEntity, error, fatalError, fireEndEntity, getDoctypePublic, getDoctypeSystem, getEncoding, getIndent, getMediaType, getNamespaceMappings, getNamespaceURI, getNamespaceURIFromPrefix, getOmitXMLDeclaration, getPrefix, getStandalone, getTransformer, getVersion, setDoctype, setDoctypePublic, setDoctypeSystem, setDocumentLocator, setEncoding, setIndent, setMediaType, setNamespaceMappings, setOmitXMLDeclaration, setSourceLocator, setStandalone, setVersion, startDocument, warning
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 SAXException
Receive notification of the beginning of a document.

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

endDocument

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

Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
SAXException
See Also:
ContentHandler.startDocument()

startPreserving

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.

Throws:
SAXException

endPreserving

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

Throws:
SAXException
See Also:
startPreserving()

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws 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:
SAXException - Any SAX exception, possibly wrapping another exception.
SAXException

entityReference

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

Specified by:
entityReference in interface ExtendedContentHandler
Overrides:
entityReference in class SerializerBase
Parameters:
name - The name of the entity.
Throws:
SAXException

addUniqueAttribute

public void addUniqueAttribute(java.lang.String name,
                               java.lang.String value,
                               int flags)
                        throws 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:
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)
                  throws SAXException
Description copied from class: SerializerBase
Adds the given attribute to the set of collected attributes , but only if there is a currently open element. An element is currently open if a startElement() notification has occured but the start of the element has not yet been written to the output. In the stream case this means that we have not yet been forced to close the elements opening tag by another notification, such as a character notification.

Specified by:
addAttribute in interface ExtendedContentHandler
Overrides:
addAttribute in class SerializerBase
Parameters:
uri - the URI of the attribute
localName - the local name of the attribute
rawName - the qualified name of the attribute
type - the type of the attribute (probably CDATA)
value - the value of the attribute
Throws:
SAXException
See Also:
ExtendedContentHandler.addAttribute(String, String, String, String, String)

endElement

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

Specified by:
endElement in interface ExtendedContentHandler
Overrides:
endElement in class ToStream
Parameters:
elemName - The element type name
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ExtendedContentHandler.endElement(String)

namespaceAfterStartElement

public void namespaceAfterStartElement(java.lang.String prefix,
                                       java.lang.String uri)
                                throws SAXException
From XSLTC Related to startPrefixMapping ???

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

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 © 2004 Apache XML Project. All Rights Reserved.