public class TransformerHandlerImpl
extends java.lang.Object
implements EntityResolver, DTDHandler, ContentHandler, ErrorHandler, LexicalHandler, TransformerHandler, DeclHandler
A TransformerHandler
listens for SAX ContentHandler parse events and transforms
them to a Result.
attributeDecl
public void attributeDecl(String eName,
String aName,
String type,
String valueDefault,
String value)
throws SAXException
Report an attribute type declaration.
Only the effective (first) declaration for an attribute will
be reported. The type will be one of the strings "CDATA",
"ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY",
"ENTITIES", or "NOTATION", or a parenthesized token group with
the separator "|" and all whitespace removed.
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 default
("#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.
characters
public void characters(ch[] ,
int start,
int length)
throws SAXException
Filter a character data event.
start
- The starting position in the array.length
- The number of characters to use from the array.
org.xml.sax.ContentHandler.characters
comment
public void comment(ch[] ,
int start,
int length)
throws SAXException
Report an XML comment anywhere in the document.
This callback will be used for comments inside or outside the
document element, including comments in the external DTD
subset (if read).
start
- The starting position in the array.length
- The number of characters to use from the array.
elementDecl
public void elementDecl(String name,
String model)
throws SAXException
Report an element type declaration.
The content model will consist of the string "EMPTY", the
string "ANY", or a parenthesised group, optionally followed
by an occurrence indicator. The model will be normalized so
that all whitespace is removed,and will include the enclosing
parentheses.
name
- The element type name.model
- The content model as a normalized string.
endCDATA
public void endCDATA()
throws SAXException
Report the end of a CDATA section.
endDTD
public void endDTD()
throws SAXException
Report the end of DTD declarations.
endDocument
public void endDocument()
throws SAXException
Filter an end document event.
org.xml.sax.ContentHandler.endDocument
endElement
public void endElement(String uri,
String localName,
String qName)
throws SAXException
Filter an end element event.
uri
- The element's Namespace URI, or the empty string.localName
- The element's local name, or the empty string.qName
- The element's qualified (prefixed) name, or the empty
string.
org.xml.sax.ContentHandler.endElement
endEntity
public void endEntity(String name)
throws SAXException
Report the end of an entity.
name
- The name of the entity that is ending.
endPrefixMapping
public void endPrefixMapping(String prefix)
throws SAXException
Filter an end Namespace prefix mapping event.
prefix
- The Namespace prefix.
org.xml.sax.ContentHandler.endPrefixMapping
error
public void error(SAXParseException e)
throws SAXException
Filter an error event.
e
- The error as an exception.
org.xml.sax.ErrorHandler.error
externalEntityDecl
public void externalEntityDecl(String name,
String publicId,
String systemId)
throws SAXException
Report a parsed external entity declaration.
Only the effective (first) declaration for each entity
will be reported.
name
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.publicId
- The declared public identifier of the entity, or
null if none was declared.systemId
- The declared system identifier of the entity.
fatalError
public void fatalError(SAXParseException e)
throws SAXException
Filter a fatal error event.
e
- The error as an exception.
org.xml.sax.ErrorHandler.fatalError
getSystemId
public String getSystemId()
Get the base ID (URI or system ID) from where relative
URLs will be resolved.
getTransformer
public Transformer getTransformer()
Get the Transformer associated with this handler, which
is needed in order to set parameters and output properties.
- The Transformer associated with this handler
ignorableWhitespace
public void ignorableWhitespace(ch[] ,
int start,
int length)
throws SAXException
Filter an ignorable whitespace event.
start
- The starting position in the array.length
- The number of characters to use from the array.
org.xml.sax.ContentHandler.ignorableWhitespace
internalEntityDecl
public void internalEntityDecl(String name,
String value)
throws SAXException
Report an internal entity declaration.
Only the effective (first) declaration for each entity
will be reported.
name
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.value
- The replacement text of the entity.
notationDecl
public void notationDecl(String name,
String publicId,
String systemId)
throws SAXException
Filter a notation declaration event.
name
- The notation name.publicId
- The notation's public identifier, or null.systemId
- The notation's system identifier, or null.
org.xml.sax.DTDHandler.notationDecl
processingInstruction
public void processingInstruction(String target,
String data)
throws SAXException
Filter a processing instruction event.
target
- The processing instruction target.data
- The text following the target.
org.xml.sax.ContentHandler.processingInstruction
resolveEntity
public InputSource resolveEntity(String publicId,
String systemId)
throws SAXException,
IOException
Filter an external entity resolution.
publicId
- The entity's public identifier, or null.systemId
- The entity's system identifier.
- A new InputSource or null for the default.
org.xml.sax.EntityResolver.resolveEntity
setDocumentLocator
public void setDocumentLocator(Locator locator)
Filter a new document locator event.
locator
- The document locator.
org.xml.sax.ContentHandler.setDocumentLocator
setResult
public void setResult(Result result)
throws IllegalArgumentException
Enables the user of the TransformerHandler to set the
to set the Result for the transformation.
result
- A Result instance, should not be null.
setSystemId
public void setSystemId(String systemID)
Set the base ID (URI or system ID) from where relative
URLs will be resolved.
systemID
- Base URI for the source tree.
skippedEntity
public void skippedEntity(String name)
throws SAXException
Filter a skipped entity event.
name
- The name of the skipped entity.
org.xml.sax.ContentHandler.skippedEntity
startCDATA
public void startCDATA()
throws SAXException
Report the start of a CDATA section.
The contents of the CDATA section will be reported through
the regular
characters
event.
startDTD
public void startDTD(String name,
String publicId,
String systemId)
throws SAXException
Report the start of DTD declarations, if any.
Any declarations are assumed to be in the internal subset
unless otherwise indicated by a
startEntity
event.
Note that the start/endDTD events will appear within
the start/endDocument events from ContentHandler and
before the first startElement event.
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.
startDocument
public void startDocument()
throws SAXException
Filter a start document event.
org.xml.sax.ContentHandler.startDocument
startElement
public void startElement(String uri,
String localName,
String qName,
Attributes atts)
throws SAXException
Filter a start element event.
uri
- The element's Namespace URI, or the empty string.localName
- The element's local name, or the empty string.qName
- The element's qualified (prefixed) name, or the empty
string.atts
- The element's attributes.
org.xml.sax.ContentHandler.startElement
startEntity
public void startEntity(String name)
throws SAXException
Report the beginning of an entity in content.
NOTE: entity references in attribute
values -- and the start and end of the document entity --
are never reported.
The start and end of the external DTD subset are reported
using the pseudo-name "[dtd]". All other events must be
properly nested within start/end entity events.
Note that skipped entities will be reported through the
skippedEntity
event, which is part of the ContentHandler interface.
name
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.
endEntity(String)
, org.xml.sax.ext.DeclHandler.internalEntityDecl
, org.xml.sax.ext.DeclHandler.externalEntityDecl
startPrefixMapping
public void startPrefixMapping(String prefix,
String uri)
throws SAXException
Filter a start Namespace prefix mapping event.
prefix
- The Namespace prefix.uri
- The Namespace URI.
org.xml.sax.ContentHandler.startPrefixMapping
unparsedEntityDecl
public void unparsedEntityDecl(String name,
String publicId,
String systemId,
String notationName)
throws SAXException
Filter an unparsed entity declaration event.
name
- The entity name.publicId
- The entity's public identifier, or null.systemId
- The entity's system identifier, or null.notationName
- The name of the associated notation.
org.xml.sax.DTDHandler.unparsedEntityDecl
warning
public void warning(SAXParseException e)
throws SAXException
Filter a warning event.
e
- The nwarning as an exception.
org.xml.sax.ErrorHandler.warning