Class ToXMLStream

All Implemented Interfaces:
DOMSerializer, ExtendedContentHandler, ExtendedLexicalHandler, SerializationHandler, Serializer, ContentHandler, DTDHandler, ErrorHandler, DeclHandler, LexicalHandler

public 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 Details

  • Constructor Details

    • ToXMLStream

      public ToXMLStream()
      Default constructor.
  • Method Details

    • 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
    • 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:
    • processingInstruction

      public void processingInstruction(String target, 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(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(String name, 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(String uri, String localName, String rawName, String type, String value, boolean xslAttribute) throws SAXException
      Add an attribute to the current element.
      Specified by:
      addAttribute in interface ExtendedContentHandler
      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:
      SAXException
      See Also:
    • endElement

      public void endElement(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:
    • namespaceAfterStartElement

      public void namespaceAfterStartElement(String prefix, String uri) throws 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.
      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:
    • 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.