|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xalan.transformer.TransformerHandlerImpl
public class TransformerHandlerImpl
A TransformerHandler listens for SAX ContentHandler parse events and transforms them to a Result.
Field Summary | |
---|---|
private static boolean |
DEBUG
Set to true for diagnostics output. |
private java.lang.String |
m_baseSystemID
The system ID to use as a base for relative URLs. |
private org.xml.sax.ContentHandler |
m_contentHandler
The content handler to aggregate to. |
private org.xml.sax.ext.DeclHandler |
m_declHandler
The decl handler to aggregate to. |
private org.xml.sax.DTDHandler |
m_dtdHandler
The DTD handler to aggregate to. |
(package private) DTM |
m_dtm
The Document Table Instance we are transforming. |
private org.xml.sax.EntityResolver |
m_entityResolver
The entity resolver to aggregate to. |
private org.xml.sax.ErrorHandler |
m_errorHandler
The error handler to aggregate to. |
private boolean |
m_incremental
The flag for the setting of the incremental feature; |
private boolean |
m_insideParse
|
private org.xml.sax.ext.LexicalHandler |
m_lexicalHandler
The lexical handler to aggregate to. |
private org.xml.sax.Locator |
m_locator
The locator for this TransformerHandler. |
private boolean |
m_optimizer
The flag for the setting of the optimize feature; |
private javax.xml.transform.Result |
m_result
The result for the transformation. |
private boolean |
m_source_location
The flag for the setting of the source_location feature; |
private TransformerImpl |
m_transformer
The transformer this will use to transform a source tree into a result tree. |
Constructor Summary | |
---|---|
TransformerHandlerImpl(TransformerImpl transformer,
boolean doFragment,
java.lang.String baseSystemID)
Construct a TransformerHandlerImpl. |
Method Summary | |
---|---|
void |
attributeDecl(java.lang.String eName,
java.lang.String aName,
java.lang.String type,
java.lang.String valueDefault,
java.lang.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(org.xml.sax.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(java.lang.String name,
java.lang.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(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
Filter an end element event. |
void |
endEntity(java.lang.String name)
Report the end of an entity. |
void |
endPrefixMapping(java.lang.String prefix)
Filter an end Namespace prefix mapping event. |
void |
error(org.xml.sax.SAXParseException e)
Filter an error event. |
void |
externalEntityDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Report a parsed external entity declaration. |
void |
fatalError(org.xml.sax.SAXParseException e)
Filter a fatal error event. |
java.lang.String |
getSystemId()
Get the base ID (URI or system ID) from where relative URLs will be resolved. |
javax.xml.transform.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(java.lang.String name,
java.lang.String value)
Report an internal entity declaration. |
void |
notationDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Filter a notation declaration event. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Filter a processing instruction event. |
org.xml.sax.InputSource |
resolveEntity(java.lang.String publicId,
java.lang.String systemId)
Filter an external entity resolution. |
void |
setDocumentLocator(org.xml.sax.Locator locator)
Filter a new document locator event. |
void |
setResult(javax.xml.transform.Result result)
Enables the user of the TransformerHandler to set the to set the Result for the transformation. |
void |
setSystemId(java.lang.String systemID)
Set the base ID (URI or system ID) from where relative URLs will be resolved. |
void |
skippedEntity(java.lang.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(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Report the start of DTD declarations, if any. |
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
Filter a start element event. |
void |
startEntity(java.lang.String name)
Report the beginning of an entity in content. |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
Filter a start Namespace prefix mapping event. |
void |
unparsedEntityDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId,
java.lang.String notationName)
Filter an unparsed entity declaration event. |
void |
warning(org.xml.sax.SAXParseException e)
Filter a warning event. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final boolean m_optimizer
private final boolean m_incremental
private final boolean m_source_location
private boolean m_insideParse
private static boolean DEBUG
private TransformerImpl m_transformer
private java.lang.String m_baseSystemID
private javax.xml.transform.Result m_result
private org.xml.sax.Locator m_locator
private org.xml.sax.EntityResolver m_entityResolver
private org.xml.sax.DTDHandler m_dtdHandler
private org.xml.sax.ContentHandler m_contentHandler
private org.xml.sax.ErrorHandler m_errorHandler
private org.xml.sax.ext.LexicalHandler m_lexicalHandler
private org.xml.sax.ext.DeclHandler m_declHandler
DTM m_dtm
Constructor Detail |
---|
public TransformerHandlerImpl(TransformerImpl transformer, boolean doFragment, java.lang.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.Method Detail |
---|
protected void clearCoRoutine()
protected void clearCoRoutine(org.xml.sax.SAXException ex)
public void setResult(javax.xml.transform.Result result) throws java.lang.IllegalArgumentException
setResult
in interface javax.xml.transform.sax.TransformerHandler
result
- A Result instance, should not be null.
java.lang.IllegalArgumentException
- if result is invalid for some reason.public void setSystemId(java.lang.String systemID)
setSystemId
in interface javax.xml.transform.sax.TransformerHandler
systemID
- Base URI for the source tree.public java.lang.String getSystemId()
getSystemId
in interface javax.xml.transform.sax.TransformerHandler
setSystemId(java.lang.String)
.public javax.xml.transform.Transformer getTransformer()
getTransformer
in interface javax.xml.transform.sax.TransformerHandler
public org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException, java.io.IOException
resolveEntity
in interface org.xml.sax.EntityResolver
publicId
- The entity's public identifier, or null.systemId
- The entity's system identifier.
java.io.IOException
org.xml.sax.SAXException
- The client may throw
an exception during processing.
java.io.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(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
notationDecl
in interface org.xml.sax.DTDHandler
name
- The notation name.publicId
- The notation's public identifier, or null.systemId
- The notation's system identifier, or null.
org.xml.sax.SAXException
- The client may throw
an exception during processing.DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)
public void unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName) throws org.xml.sax.SAXException
unparsedEntityDecl
in interface org.xml.sax.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.
org.xml.sax.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(org.xml.sax.Locator locator)
setDocumentLocator
in interface org.xml.sax.ContentHandler
locator
- The document locator.ContentHandler.setDocumentLocator(org.xml.sax.Locator)
public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
- The client may throw
an exception during processing.ContentHandler.startDocument()
public void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
- The client may throw
an exception during processing.ContentHandler.endDocument()
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException
startPrefixMapping
in interface org.xml.sax.ContentHandler
prefix
- The Namespace prefix.uri
- The Namespace URI.
org.xml.sax.SAXException
- The client may throw
an exception during processing.ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)
public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException
endPrefixMapping
in interface org.xml.sax.ContentHandler
prefix
- The Namespace prefix.
org.xml.sax.SAXException
- The client may throw
an exception during processing.ContentHandler.endPrefixMapping(java.lang.String)
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.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.
org.xml.sax.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(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.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.
org.xml.sax.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 org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
ch
- An array of characters.start
- The starting position in the array.length
- The number of characters to use from the array.
org.xml.sax.SAXException
- The client may throw
an exception during processing.ContentHandler.characters(char[], int, int)
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
ignorableWhitespace
in interface org.xml.sax.ContentHandler
ch
- An array of characters.start
- The starting position in the array.length
- The number of characters to use from the array.
org.xml.sax.SAXException
- The client may throw
an exception during processing.ContentHandler.ignorableWhitespace(char[], int, int)
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
processingInstruction
in interface org.xml.sax.ContentHandler
target
- The processing instruction target.data
- The text following the target.
org.xml.sax.SAXException
- The client may throw
an exception during processing.ContentHandler.processingInstruction(java.lang.String, java.lang.String)
public void skippedEntity(java.lang.String name) throws org.xml.sax.SAXException
skippedEntity
in interface org.xml.sax.ContentHandler
name
- The name of the skipped entity.
org.xml.sax.SAXException
- The client may throw
an exception during processing.ContentHandler.skippedEntity(java.lang.String)
public void warning(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException
warning
in interface org.xml.sax.ErrorHandler
e
- The nwarning as an exception.
org.xml.sax.SAXException
- The client may throw
an exception during processing.ErrorHandler.warning(org.xml.sax.SAXParseException)
public void error(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException
error
in interface org.xml.sax.ErrorHandler
e
- The error as an exception.
org.xml.sax.SAXException
- The client may throw
an exception during processing.ErrorHandler.error(org.xml.sax.SAXParseException)
public void fatalError(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException
fatalError
in interface org.xml.sax.ErrorHandler
e
- The error as an exception.
org.xml.sax.SAXException
- The client may throw
an exception during processing.ErrorHandler.fatalError(org.xml.sax.SAXParseException)
public void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.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 org.xml.sax.ext.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.
org.xml.sax.SAXException
- The application may raise an
exception.endDTD()
,
startEntity(java.lang.String)
public void endDTD() throws org.xml.sax.SAXException
endDTD
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
- The application may raise an exception.startDTD(java.lang.String, java.lang.String, java.lang.String)
public void startEntity(java.lang.String name) throws org.xml.sax.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 org.xml.sax.ext.LexicalHandler
name
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.
org.xml.sax.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(java.lang.String name) throws org.xml.sax.SAXException
endEntity
in interface org.xml.sax.ext.LexicalHandler
name
- The name of the entity that is ending.
org.xml.sax.SAXException
- The application may raise an exception.startEntity(java.lang.String)
public void startCDATA() throws org.xml.sax.SAXException
The contents of the CDATA section will be reported through
the regular characters
event.
startCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
- The application may raise an exception.endCDATA()
public void endCDATA() throws org.xml.sax.SAXException
endCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
- The application may raise an exception.startCDATA()
public void comment(char[] ch, int start, int length) throws org.xml.sax.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 org.xml.sax.ext.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.
org.xml.sax.SAXException
- The application may raise an exception.public void elementDecl(java.lang.String name, java.lang.String model) throws org.xml.sax.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 org.xml.sax.ext.DeclHandler
name
- The element type name.model
- The content model as a normalized string.
org.xml.sax.SAXException
- The application may raise an exception.public void attributeDecl(java.lang.String eName, java.lang.String aName, java.lang.String type, java.lang.String valueDefault, java.lang.String value) throws org.xml.sax.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 org.xml.sax.ext.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.
org.xml.sax.SAXException
- The application may raise an exception.public void internalEntityDecl(java.lang.String name, java.lang.String value) throws org.xml.sax.SAXException
Only the effective (first) declaration for each entity will be reported.
internalEntityDecl
in interface org.xml.sax.ext.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.
org.xml.sax.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(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
Only the effective (first) declaration for each entity will be reported.
externalEntityDecl
in interface org.xml.sax.ext.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.
org.xml.sax.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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |