public class TransformerHandlerImpl extends Object implements EntityResolver, DTDHandler, ContentHandler, ErrorHandler, LexicalHandler, TransformerHandler, DeclHandler
Constructor and Description |
---|
TransformerHandlerImpl(TransformerImpl transformer,
boolean doFragment,
String baseSystemID)
Construct a TransformerHandlerImpl.
|
Modifier and Type | Method and Description |
---|---|
void |
attributeDecl(String eName,
String aName,
String type,
String valueDefault,
String value)
Report an attribute type declaration.
|
void |
characters(char[] ch,
int start,
int length)
Filter a character data event.
|
protected void |
clearCoRoutine()
Do what needs to be done to shut down the CoRoutine management.
|
protected void |
clearCoRoutine(SAXException ex)
Do what needs to be done to shut down the CoRoutine management.
|
void |
comment(char[] ch,
int start,
int length)
Report an XML comment anywhere in the document.
|
void |
elementDecl(String name,
String model)
Report an element type declaration.
|
void |
endCDATA()
Report the end of a CDATA section.
|
void |
endDocument()
Filter an end document event.
|
void |
endDTD()
Report the end of DTD declarations.
|
void |
endElement(String uri,
String localName,
String qName)
Filter an end element event.
|
void |
endEntity(String name)
Report the end of an entity.
|
void |
endPrefixMapping(String prefix)
Filter an end Namespace prefix mapping event.
|
void |
error(SAXParseException e)
Filter an error event.
|
void |
externalEntityDecl(String name,
String publicId,
String systemId)
Report a parsed external entity declaration.
|
void |
fatalError(SAXParseException e)
Filter a fatal error event.
|
String |
getSystemId()
Get the base ID (URI or system ID) from where relative
URLs will be resolved.
|
Transformer |
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)
Filter an ignorable whitespace event.
|
void |
internalEntityDecl(String name,
String value)
Report an internal entity declaration.
|
void |
notationDecl(String name,
String publicId,
String systemId)
Filter a notation declaration event.
|
void |
processingInstruction(String target,
String data)
Filter a processing instruction event.
|
InputSource |
resolveEntity(String publicId,
String systemId)
Filter an external entity resolution.
|
void |
setDocumentLocator(Locator locator)
Filter a new document locator event.
|
void |
setResult(Result result)
Enables the user of the TransformerHandler to set the
to set the Result for the transformation.
|
void |
setSystemId(String systemID)
Set the base ID (URI or system ID) from where relative
URLs will be resolved.
|
void |
skippedEntity(String name)
Filter a skipped entity event.
|
void |
startCDATA()
Report the start of a CDATA section.
|
void |
startDocument()
Filter a start document event.
|
void |
startDTD(String name,
String publicId,
String systemId)
Report the start of DTD declarations, if any.
|
void |
startElement(String uri,
String localName,
String qName,
Attributes atts)
Filter a start element event.
|
void |
startEntity(String name)
Report the beginning of an entity in content.
|
void |
startPrefixMapping(String prefix,
String uri)
Filter a start Namespace prefix mapping event.
|
void |
unparsedEntityDecl(String name,
String publicId,
String systemId,
String notationName)
Filter an unparsed entity declaration event.
|
void |
warning(SAXParseException e)
Filter a warning event.
|
public TransformerHandlerImpl(TransformerImpl transformer, boolean doFragment, String baseSystemID)
transformer
- Non-null reference to the Xalan transformer impl.doFragment
- True if the result should be a document fragement.baseSystemID
- The system ID to use as the base for relative URLs.protected void clearCoRoutine()
protected void clearCoRoutine(SAXException ex)
public void setResult(Result result) throws IllegalArgumentException
setResult
in interface TransformerHandler
result
- A Result instance, should not be null.IllegalArgumentException
- if result is invalid for some reason.public void setSystemId(String systemID)
setSystemId
in interface TransformerHandler
systemID
- Base URI for the source tree.public String getSystemId()
getSystemId
in interface TransformerHandler
setSystemId(java.lang.String)
.public Transformer getTransformer()
getTransformer
in interface TransformerHandler
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
resolveEntity
in interface EntityResolver
publicId
- The entity's public identifier, or null.systemId
- The entity's system identifier.IOException
SAXException
- The client may throw
an exception during processing.IOException
- The client may throw an
I/O-related exception while obtaining the
new InputSource.EntityResolver.resolveEntity(java.lang.String, java.lang.String)
public void notationDecl(String name, String publicId, String systemId) throws SAXException
notationDecl
in interface DTDHandler
name
- The notation name.publicId
- The notation's public identifier, or null.systemId
- The notation's system identifier, or null.SAXException
- The client may throw
an exception during processing.DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)
public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException
unparsedEntityDecl
in interface DTDHandler
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.SAXException
- The client may throw
an exception during processing.DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
locator
- The document locator.ContentHandler.setDocumentLocator(org.xml.sax.Locator)
public void startDocument() throws SAXException
startDocument
in interface ContentHandler
SAXException
- The client may throw
an exception during processing.ContentHandler.startDocument()
public void endDocument() throws SAXException
endDocument
in interface ContentHandler
SAXException
- The client may throw
an exception during processing.ContentHandler.endDocument()
public void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping
in interface ContentHandler
prefix
- The Namespace prefix.uri
- The Namespace URI.SAXException
- The client may throw
an exception during processing.ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)
public void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping
in interface ContentHandler
prefix
- The Namespace prefix.SAXException
- The client may throw
an exception during processing.ContentHandler.endPrefixMapping(java.lang.String)
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
startElement
in interface ContentHandler
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.SAXException
- The client may throw
an exception during processing.ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
public void endElement(String uri, String localName, String qName) throws SAXException
endElement
in interface ContentHandler
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.SAXException
- The client may throw
an exception during processing.ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
public void characters(char[] ch, int start, int length) throws SAXException
characters
in interface ContentHandler
ch
- An array of characters.start
- The starting position in the array.length
- The number of characters to use from the array.SAXException
- The client may throw
an exception during processing.ContentHandler.characters(char[], int, int)
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
ignorableWhitespace
in interface ContentHandler
ch
- An array of characters.start
- The starting position in the array.length
- The number of characters to use from the array.SAXException
- The client may throw
an exception during processing.ContentHandler.ignorableWhitespace(char[], int, int)
public void processingInstruction(String target, String data) throws SAXException
processingInstruction
in interface ContentHandler
target
- The processing instruction target.data
- The text following the target.SAXException
- The client may throw
an exception during processing.ContentHandler.processingInstruction(java.lang.String, java.lang.String)
public void skippedEntity(String name) throws SAXException
skippedEntity
in interface ContentHandler
name
- The name of the skipped entity.SAXException
- The client may throw
an exception during processing.ContentHandler.skippedEntity(java.lang.String)
public void warning(SAXParseException e) throws SAXException
warning
in interface ErrorHandler
e
- The nwarning as an exception.SAXException
- The client may throw
an exception during processing.ErrorHandler.warning(org.xml.sax.SAXParseException)
public void error(SAXParseException e) throws SAXException
error
in interface ErrorHandler
e
- The error as an exception.SAXException
- The client may throw
an exception during processing.ErrorHandler.error(org.xml.sax.SAXParseException)
public void fatalError(SAXParseException e) throws SAXException
fatalError
in interface ErrorHandler
e
- The error as an exception.SAXException
- The client may throw
an exception during processing.ErrorHandler.fatalError(org.xml.sax.SAXParseException)
public void startDTD(String name, String publicId, String systemId) throws SAXException
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.
startDTD
in interface LexicalHandler
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.SAXException
- The application may raise an
exception.endDTD()
,
startEntity(java.lang.String)
public void endDTD() throws SAXException
endDTD
in interface LexicalHandler
SAXException
- The application may raise an exception.startDTD(java.lang.String, java.lang.String, java.lang.String)
public void startEntity(String name) throws SAXException
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.
startEntity
in interface LexicalHandler
name
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.SAXException
- The application may raise an exception.endEntity(java.lang.String)
,
DeclHandler.internalEntityDecl(java.lang.String, java.lang.String)
,
DeclHandler.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)
public void endEntity(String name) throws SAXException
endEntity
in interface LexicalHandler
name
- The name of the entity that is ending.SAXException
- The application may raise an exception.startEntity(java.lang.String)
public void startCDATA() throws SAXException
The contents of the CDATA section will be reported through
the regular characters
event.
startCDATA
in interface LexicalHandler
SAXException
- The application may raise an exception.endCDATA()
public void endCDATA() throws SAXException
endCDATA
in interface LexicalHandler
SAXException
- The application may raise an exception.startCDATA()
public void comment(char[] ch, int start, int length) throws SAXException
This callback will be used for comments inside or outside the document element, including comments in the external DTD subset (if read).
comment
in interface LexicalHandler
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.SAXException
- The application may raise an exception.public void elementDecl(String name, String model) throws SAXException
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.
elementDecl
in interface DeclHandler
name
- The element type name.model
- The content model as a normalized string.SAXException
- The application may raise an exception.public void attributeDecl(String eName, String aName, String type, String valueDefault, String value) throws SAXException
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.
attributeDecl
in interface DeclHandler
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.SAXException
- The application may raise an exception.public void internalEntityDecl(String name, String value) throws SAXException
Only the effective (first) declaration for each entity will be reported.
internalEntityDecl
in interface DeclHandler
name
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.value
- The replacement text of the entity.SAXException
- The application may raise an exception.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)
,
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void externalEntityDecl(String name, String publicId, String systemId) throws SAXException
Only the effective (first) declaration for each entity will be reported.
externalEntityDecl
in interface DeclHandler
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.SAXException
- The application may raise an exception.internalEntityDecl(java.lang.String, java.lang.String)
,
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
Copyright © 2021 JBoss by Red Hat. All rights reserved.