org.apache.xalan.xsltc.trax

## Class TransformerHandlerImpl

- java.lang.Object
- - org.apache.xalan.xsltc.trax.TransformerHandlerImpl

All Implemented Interfaces:
  TransformerHandler, ContentHandler, DTDHandler, DeclHandler, LexicalHandler

    public class TransformerHandlerImpl
    extends java.lang.Object
    implements TransformerHandler, DeclHandler

Implementation of a JAXP1.1 TransformerHandler

Author:
  Morten Jorgensen

### Constructor Summary

Constructors
Constructor and Description
`TransformerHandlerImpl(TransformerImpl transformer)` Cosntructor - pass in reference to a TransformerImpl object

### Method Summary

Methods
`void` `attributeDecl(java.lang.String eName, java.lang.String aName, java.lang.String type, java.lang.String valueDefault, java.lang.String value)` Implements org.xml.sax.ext.DeclHandler.attributeDecl()
`void` `characters(char[] ch, int start, int length)` Implements org.xml.sax.ContentHandler.characters() Receive notification of character data.
`void` `comment(char[] ch, int start, int length)` Implements org.xml.sax.ext.LexicalHandler.comment() Receieve notification of a comment
`void` `elementDecl(java.lang.String name, java.lang.String model)` Implements org.xml.sax.ext.DeclHandler.elementDecl()
`void` `endCDATA()` Implements org.xml.sax.ext.LexicalHandler.endCDATA()
`void` `endDocument()` Implements org.xml.sax.ContentHandler.endDocument() Receive notification of the end of a document.
`void` `endDTD()` Implements org.xml.sax.ext.LexicalHandler.endDTD()
`void` `endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qname)` Implements org.xml.sax.ContentHandler.endElement() Receive notification of the end of an element.
`void` `endEntity(java.lang.String name)` Implements org.xml.sax.ext.LexicalHandler.endEntity()
`void` `endPrefixMapping(java.lang.String prefix)` Implements org.xml.sax.ContentHandler.endPrefixMapping() End the scope of a prefix-URI Namespace mapping.
`void` `externalEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)` Implements org.xml.sax.ext.DeclHandler.externalEntityDecl()
`java.lang.String` `getSystemId()` Implements javax.xml.transform.sax.TransformerHandler.getSystemId() Get the base ID (URI or system ID) from where relative URLs will be resolved.
`Transformer` `getTransformer()` Implements javax.xml.transform.sax.TransformerHandler.getTransformer() Get the Transformer associated with this handler, which is needed in order to set parameters and output properties.
`void` `ignorableWhitespace(char[] ch, int start, int length)` Implements org.xml.sax.ContentHandler.ignorableWhitespace() Receive notification of ignorable whitespace in element content.
`void` `internalEntityDecl(java.lang.String name, java.lang.String value)` Implements org.xml.sax.ext.DeclHandler.externalEntityDecl()
`void` `notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)` Implements org.xml.sax.DTDHandler.notationDecl()
`void` `processingInstruction(java.lang.String target, java.lang.String data)` Implements org.xml.sax.ContentHandler.processingInstruction() Receive notification of a processing instruction.
`void` `setDocumentLocator(Locator locator)` Implements org.xml.sax.ContentHandler.setDocumentLocator() Receive an object for locating the origin of SAX document events.
`void` `setResult(Result result)` Implements javax.xml.transform.sax.TransformerHandler.setResult() Enables the user of the TransformerHandler to set the to set the Result for the transformation.
`void` `setSystemId(java.lang.String id)` Implements javax.xml.transform.sax.TransformerHandler.setSystemId() Get the base ID (URI or system ID) from where relative URLs will be resolved.
`void` `skippedEntity(java.lang.String name)` Implements org.xml.sax.ContentHandler.skippedEntity() Receive notification of a skipped entity.
`void` `startCDATA()` Implements org.xml.sax.ext.LexicalHandler.startCDATA()
`void` `startDocument()` Implements org.xml.sax.ContentHandler.startDocument() Receive notification of the beginning of a document.
`void` `startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)` Implements org.xml.sax.ext.LexicalHandler.startDTD()
`void` `startElement(java.lang.String uri, java.lang.String localName, java.lang.String qname, Attributes attributes)` Implements org.xml.sax.ContentHandler.startElement() Receive notification of the beginning of an element.
`void` `startEntity(java.lang.String name)` Implements org.xml.sax.ext.LexicalHandler.startEntity()
`void` `startPrefixMapping(java.lang.String prefix, java.lang.String uri)` Implements org.xml.sax.ContentHandler.startPrefixMapping() Begin the scope of a prefix-URI Namespace mapping.
`void` `unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName)` Implements org.xml.sax.DTDHandler.unparsedEntityDecl()

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### TransformerHandlerImpl

    public TransformerHandlerImpl(TransformerImpl transformer)

Cosntructor - pass in reference to a TransformerImpl object

### Method Detail

#### getSystemId

    public java.lang.String getSystemId()

Implements javax.xml.transform.sax.TransformerHandler.getSystemId() Get the base ID (URI or system ID) from where relative URLs will be resolved.

Specified by:
  `getSystemId` in interface `TransformerHandler`
Returns:
  The systemID that was set with setSystemId(String id)

#### setSystemId

    public void setSystemId(java.lang.String id)

Implements javax.xml.transform.sax.TransformerHandler.setSystemId() Get the base ID (URI or system ID) from where relative URLs will be resolved.

Specified by:
  `setSystemId` in interface `TransformerHandler`
Parameters:
  `id` - Base URI for this stylesheet

#### getTransformer

    public Transformer getTransformer()

Implements javax.xml.transform.sax.TransformerHandler.getTransformer() Get the Transformer associated with this handler, which is needed in order to set parameters and output properties.

Specified by:
  `getTransformer` in interface `TransformerHandler`
Returns:
  The Transformer object

#### setResult

    public void setResult(Result result)
                   throws java.lang.IllegalArgumentException

Implements javax.xml.transform.sax.TransformerHandler.setResult() Enables the user of the TransformerHandler to set the to set the Result for the transformation.

Specified by:
  `setResult` in interface `TransformerHandler`
Parameters:
  `result` - A Result instance, should not be null
Throws:
  `java.lang.IllegalArgumentException` - if result is invalid for some reason

#### characters

    public void characters(char[] ch,
                  int start,
                  int length)
                    throws SAXException

Implements org.xml.sax.ContentHandler.characters() Receive notification of character data.

Specified by:
  `characters` in interface `ContentHandler`
Parameters:
  `ch` - the characters from the XML document
  `start` - the start position in the array
  `length` - the number of characters to read from the array
Throws:
  `SAXException` - any SAX exception, possibly wrapping another exception
See Also:
  `ContentHandler.ignorableWhitespace(char[], int, int)`, `Locator`

#### startDocument

    public void startDocument()
                       throws SAXException

Implements org.xml.sax.ContentHandler.startDocument() Receive notification of the beginning of a document.

Specified by:
  `startDocument` in interface `ContentHandler`
Throws:
  `SAXException` - any SAX exception, possibly wrapping another exception
See Also:
  `ContentHandler.endDocument()`

#### endDocument

    public void endDocument()
                     throws SAXException

Implements org.xml.sax.ContentHandler.endDocument() Receive notification of the end of a document.

Specified by:
  `endDocument` in interface `ContentHandler`
Throws:
  `SAXException` - any SAX exception, possibly wrapping another exception
See Also:
  `ContentHandler.startDocument()`

#### startElement

    public void startElement(java.lang.String uri,
                    java.lang.String localName,
                    java.lang.String qname,
                    Attributes attributes)
                      throws SAXException

Implements org.xml.sax.ContentHandler.startElement() Receive notification of the beginning of an element.

Specified by:
  `startElement` in interface `ContentHandler`
Parameters:
  `uri` - the Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed
  `localName` - the local name (without prefix), or the empty string if Namespace processing is not being performed
  `qname` - the qualified name (with prefix), or the empty string if qualified names are not available
  `attributes` - the attributes attached to the element. If there are no attributes, it shall be an empty Attributes object. The value of this object after startElement returns is undefined
Throws:
  `SAXException` - any SAX exception, possibly wrapping another exception
See Also:
  `ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)`, `Attributes`, `AttributesImpl`

#### endElement

    public void endElement(java.lang.String namespaceURI,
                  java.lang.String localName,
                  java.lang.String qname)
                    throws SAXException

Implements org.xml.sax.ContentHandler.endElement() Receive notification of the end of an element.

Specified by:
  `endElement` in interface `ContentHandler`
Parameters:
  `namespaceURI` - the Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed
  `localName` - the local name (without prefix), or the empty string if Namespace processing is not being performed
  `qname` - the qualified XML name (with prefix), or the empty string if qualified names are not available
Throws:
  `SAXException` - any SAX exception, possibly wrapping another exception

#### processingInstruction

    public void processingInstruction(java.lang.String target,
                             java.lang.String data)
                               throws SAXException

Implements org.xml.sax.ContentHandler.processingInstruction() Receive notification of a processing instruction.

Specified by:
  `processingInstruction` in interface `ContentHandler`
Parameters:
  `target` - the processing instruction target
  `data` - the processing instruction data, or null if none was supplied. The data does not include any whitespace separating it from the target
Throws:
  `SAXException` - any SAX exception, possibly wrapping another exception

#### startCDATA

    public void startCDATA()
                    throws SAXException

Implements org.xml.sax.ext.LexicalHandler.startCDATA()

Specified by:
  `startCDATA` in interface `LexicalHandler`
Throws:
  `SAXException` - The application may raise an exception.
See Also:
  `LexicalHandler.endCDATA()`

#### endCDATA

    public void endCDATA()
                  throws SAXException

Implements org.xml.sax.ext.LexicalHandler.endCDATA()

Specified by:
  `endCDATA` in interface `LexicalHandler`
Throws:
  `SAXException` - The application may raise an exception.
See Also:
  `LexicalHandler.startCDATA()`

#### comment

    public void comment(char[] ch,
               int start,
               int length)
                 throws SAXException

Implements org.xml.sax.ext.LexicalHandler.comment() Receieve notification of a comment

Specified by:
  `comment` in interface `LexicalHandler`
Parameters:
  `ch` - An array holding the characters in the comment.
  `start` - The starting position in the array.
  `length` - The number of characters to use from the array.
Throws:
  `SAXException` - The application may raise an exception.

#### ignorableWhitespace

    public void ignorableWhitespace(char[] ch,
                           int start,
                           int length)
                             throws SAXException

Implements org.xml.sax.ContentHandler.ignorableWhitespace() Receive notification of ignorable whitespace in element content. Similar to characters(char[], int, int).

Specified by:
  `ignorableWhitespace` in interface `ContentHandler`
Parameters:
  `ch` - the characters from the XML document
  `start` - the start position in the array
  `length` - the number of characters to read from the array
Throws:
  `SAXException` - any SAX exception, possibly wrapping another exception
See Also:
  `ContentHandler.characters(char[], int, int)`

#### setDocumentLocator

    public void setDocumentLocator(Locator locator)

Implements org.xml.sax.ContentHandler.setDocumentLocator() Receive an object for locating the origin of SAX document events.

Specified by:
  `setDocumentLocator` in interface `ContentHandler`
Parameters:
  `locator` - an object that can return the location of any SAX document event
See Also:
  `Locator`

#### skippedEntity

    public void skippedEntity(java.lang.String name)
                       throws SAXException

Implements org.xml.sax.ContentHandler.skippedEntity() Receive notification of a skipped entity.

Specified by:
  `skippedEntity` in interface `ContentHandler`
Parameters:
  `name` - the name of the skipped entity. If it is a parameter entity, the name will begin with '%', and if it is the external DTD subset, it will be the string "[dtd]"
Throws:
  `SAXException` - any SAX exception, possibly wrapping another exception

#### startPrefixMapping

    public void startPrefixMapping(java.lang.String prefix,
                          java.lang.String uri)
                            throws SAXException

Implements org.xml.sax.ContentHandler.startPrefixMapping() Begin the scope of a prefix-URI Namespace mapping.

Specified by:
  `startPrefixMapping` in interface `ContentHandler`
Parameters:
  `prefix` - the Namespace prefix being declared. An empty string is used for the default element namespace, which has no prefix.
  `uri` - the Namespace URI the prefix is mapped to
Throws:
  `SAXException` - the client may throw an exception during processing
See Also:
  `ContentHandler.endPrefixMapping(java.lang.String)`, `ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)`

#### endPrefixMapping

    public void endPrefixMapping(java.lang.String prefix)
                          throws SAXException

Implements org.xml.sax.ContentHandler.endPrefixMapping() End the scope of a prefix-URI Namespace mapping.

Specified by:
  `endPrefixMapping` in interface `ContentHandler`
Parameters:
  `prefix` - the prefix that was being mapped. This is the empty string when a default mapping scope ends.
Throws:
  `SAXException` - the client may throw an exception during processing
See Also:
  `ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)`, `ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)`

#### startDTD

    public void startDTD(java.lang.String name,
                java.lang.String publicId,
                java.lang.String systemId)
                  throws SAXException

Implements org.xml.sax.ext.LexicalHandler.startDTD()

Specified by:
  `startDTD` in interface `LexicalHandler`
Parameters:
  `name` - The document type name.
  `publicId` - The declared public identifier for the external DTD subset, or null if none was declared.
  `systemId` - The declared system identifier for the external DTD subset, or null if none was declared. (Note that this is not resolved against the document base URI.)
Throws:
  `SAXException` - The application may raise an exception.
See Also:
  `LexicalHandler.endDTD()`, `LexicalHandler.startEntity(java.lang.String)`

#### endDTD

    public void endDTD()
                throws SAXException

Implements org.xml.sax.ext.LexicalHandler.endDTD()

Specified by:
  `endDTD` in interface `LexicalHandler`
Throws:
  `SAXException` - The application may raise an exception.
See Also:
  `LexicalHandler.startDTD(java.lang.String, java.lang.String, java.lang.String)`

#### startEntity

    public void startEntity(java.lang.String name)
                     throws SAXException

Implements org.xml.sax.ext.LexicalHandler.startEntity()

Specified by:
  `startEntity` in interface `LexicalHandler`
Parameters:
  `name` - The name of the entity. If it is a parameter entity, the name will begin with '%', and if it is the external DTD subset, it will be "[dtd]".
Throws:
  `SAXException` - The application may raise an exception.
See Also:
  `LexicalHandler.endEntity(java.lang.String)`, `DeclHandler.internalEntityDecl(java.lang.String, java.lang.String)`, `DeclHandler.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)`

#### endEntity

    public void endEntity(java.lang.String name)
                   throws SAXException

Implements org.xml.sax.ext.LexicalHandler.endEntity()

Specified by:
  `endEntity` in interface `LexicalHandler`
Parameters:
  `name` - The name of the entity that is ending.
Throws:
  `SAXException` - The application may raise an exception.
See Also:
  `LexicalHandler.startEntity(java.lang.String)`

#### unparsedEntityDecl

    public void unparsedEntityDecl(java.lang.String name,
                          java.lang.String publicId,
                          java.lang.String systemId,
                          java.lang.String notationName)
                            throws SAXException

Implements org.xml.sax.DTDHandler.unparsedEntityDecl()

Specified by:
  `unparsedEntityDecl` in interface `DTDHandler`
Parameters:
  `name` - The unparsed entity's name.
  `publicId` - The entity's public identifier, or null if none was given.
  `systemId` - The entity's system identifier.
  `notationName` - The name of the associated notation.
Throws:
  `SAXException` - Any SAX exception, possibly wrapping another exception.
See Also:
  `DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)`, `Attributes`

#### notationDecl

    public void notationDecl(java.lang.String name,
                    java.lang.String publicId,
                    java.lang.String systemId)
                      throws SAXException

Implements org.xml.sax.DTDHandler.notationDecl()

Specified by:
  `notationDecl` in interface `DTDHandler`
Parameters:
  `name` - The notation name.
  `publicId` - The notation's public identifier, or null if none was given.
  `systemId` - The notation's system identifier, or null if none was given.
Throws:
  `SAXException` - Any SAX exception, possibly wrapping another exception.
See Also:
  `DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)`, `Attributes`

#### attributeDecl

    public void attributeDecl(java.lang.String eName,
                     java.lang.String aName,
                     java.lang.String type,
                     java.lang.String valueDefault,
                     java.lang.String value)
                       throws SAXException

Implements org.xml.sax.ext.DeclHandler.attributeDecl()

Specified by:
  `attributeDecl` in interface `DeclHandler`
Parameters:
  `eName` - The name of the associated element.
  `aName` - The name of the attribute.
  `type` - A string representing the attribute type.
  `valueDefault` - A string representing the attribute defaulting mode ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if none of these applies.
  `value` - A string representing the attribute's default value, or null if there is none.
Throws:
  `SAXException` - The application may raise an exception.

#### elementDecl

    public void elementDecl(java.lang.String name,
                   java.lang.String model)
                     throws SAXException

Implements org.xml.sax.ext.DeclHandler.elementDecl()

Specified by:
  `elementDecl` in interface `DeclHandler`
Parameters:
  `name` - The element type name.
  `model` - The content model as a normalized string.
Throws:
  `SAXException` - The application may raise an exception.

#### externalEntityDecl

    public void externalEntityDecl(java.lang.String name,
                          java.lang.String publicId,
                          java.lang.String systemId)
                            throws SAXException

Implements org.xml.sax.ext.DeclHandler.externalEntityDecl()

Specified by:
  `externalEntityDecl` in interface `DeclHandler`
Parameters:
  `name` - The name of the entity. If it is a parameter entity, the name will begin with '%'.
  `publicId` - The entity's public identifier, or null if none was given.
  `systemId` - The entity's system identifier.
Throws:
  `SAXException` - The application may raise an exception.
See Also:
  `DeclHandler.internalEntityDecl(java.lang.String, java.lang.String)`, `DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)`

#### internalEntityDecl

    public void internalEntityDecl(java.lang.String name,
                          java.lang.String value)
                            throws SAXException

Implements org.xml.sax.ext.DeclHandler.externalEntityDecl()

Specified by:
  `internalEntityDecl` in interface `DeclHandler`
Parameters:
  `name` - The name of the entity. If it is a parameter entity, the name will begin with '%'.
  `value` - The replacement text of the entity.
Throws:
  `SAXException` - The application may raise an exception.
See Also:
  `DeclHandler.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)`, `DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)`