public abstract class XMLPushFilterImpl extends java.lang.Object implements XMLPushFilter
A framework class which can be easily extended to provide custom push-mode SAX event filtering.
This class can be used to provide a Java equivalent of the JAXP TransformerHandler. When used directly it simply copies SAX events from input to the output and is equivalent to creating a TransformerHandler without an associated XSLT stylesheet or Template. When extended it can be used to provide custom behaviour and a route to the possible reimplementation of XSLT based TransformerHandlers directly in Java.
Constructor and Description |
---|
XMLPushFilterImpl()
Create a new instance of XMLPushFilterImpl.
|
Modifier and Type | Method and Description |
---|---|
void |
attributeDecl(java.lang.String eName,
java.lang.String aName,
java.lang.String type,
java.lang.String mode,
java.lang.String value)
An implementation of the DeclHandler attributeDecl method.
|
void |
characters(char[] ch,
int start,
int length)
An extensible implementation of the ContentHandler characters method.
|
void |
comment(char[] ch,
int start,
int length)
An extensible implementation of the LexicalHandler comment method.
|
void |
elementDecl(java.lang.String name,
java.lang.String model)
An implementation of the DeclHandler elementDecl method.
|
void |
endCDATA()
An extensible implementation of the LexicalHandler endCDATA method.
|
void |
endDocument()
An extensible implementation of the ContentHandler endDocument method.
|
void |
endDTD()
An extensible implementation of the LexicalHandler endDTD method.
|
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
An extensible implementation of the ContentHandler endElement method.
|
void |
endEntity(java.lang.String name)
An extensible implementation of the LexicalHandler endEntity method.
|
void |
endPrefixMapping(java.lang.String prefix)
An extensible implementation of the ContentHandler endPrefixMapping method.
|
void |
externalEntityDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
An implementation of the DeclHandler externalEntityDecl method.
|
void |
ignorableWhitespace(char[] ch,
int start,
int length)
An extensible implementation of the ContentHandler ignorableWhitespace method.
|
void |
internalEntityDecl(java.lang.String name,
java.lang.String value)
An implementation of the DeclHandler internalEntityDecl method.
|
void |
notationDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Filter a notationDecl event.
|
void |
processingInstruction(java.lang.String target,
java.lang.String data)
An extensible implementation of the ContentHandler processingInstruction method.
|
void |
setDocumentLocator(org.xml.sax.Locator locator)
An extensible implementation of the ContentHandler setDocumentLocator method.
|
void |
setResult(javax.xml.transform.Result result)
Enables the user to set the Result of the transformation.
|
void |
skippedEntity(java.lang.String name)
An extensible implementation of the ContentHandler skippedEntity method.
|
void |
startCDATA()
An extensible implementation of the LexicalHandler startCDATA method.
|
void |
startDocument()
An extensible implementation of the ContentHandler startDocument method.
|
void |
startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
An extensible implementation of the LexicalHandler startDTD method.
|
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
An extensible implementation of the ContentHandler startElement method.
|
void |
startEntity(java.lang.String name)
An extensible implementation of the LexicalHandler startEntity method.
|
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
An extensible implementation of the ContentHandler startPrefixMapping method.
|
void |
unparsedEntityDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId,
java.lang.String notationName)
An extensible implementation of the DTDHandler unparsedEntityDecl method.
|
public XMLPushFilterImpl()
public void setResult(javax.xml.transform.Result result) throws java.lang.IllegalArgumentException
setResult
in interface XMLPushFilter
result
- a Result instance. Should not be null.java.lang.IllegalArgumentException
- if the parameter is nullXMLPushFilter.setResult(Result)
,
TransformerHandler.setResult(javax.xml.transform.Result)
public void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator
in interface org.xml.sax.ContentHandler
locator
- - an object that can return the location of any SAX document eventContentHandler.setDocumentLocator(org.xml.sax.Locator)
public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
- if the Result ContentHandler throws a SAXExceptionContentHandler.startDocument()
public void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
- if the Result ContentHandler throws a SAXExceptionContentHandler.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 prefixuri
- - the namespace URIorg.xml.sax.SAXException
- if the Result ContentHandler throws a SAXExceptionContentHandler.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 prefixorg.xml.sax.SAXException
- if the Result ContentHandler throws a SAXExceptionContentHandler.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 Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not
being performedlocalName
- - the local name (without prefix), or the empty string if Namespace processing is not being performedqName
- - the qualified name (with prefix), or the empty string if qualified names are not availableatts
- - 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 undefinedorg.xml.sax.SAXException
- if the Result ContentHandler throws a SAXExceptionContentHandler.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 Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not
being performedlocalName
- - the local name (without prefix), or the empty string if Namespace processing is not being performedqName
- - the qualified XML name (with prefix), or the empty string if qualified names are not availableorg.xml.sax.SAXException
- if the Result ContentHandler throws a SAXExceptionContentHandler.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
- - the characters from the XML documentstart
- - the start position in the arraylength
- - the number of characters to read from the arrayorg.xml.sax.SAXException
- if the Result ContentHandler throws a SAXExceptionContentHandler.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
- - the characters from the XML documentstart
- - the start position in the arraylength
- - the number of characters to read from the arrayorg.xml.sax.SAXException
- if the Result ContentHandler throws a SAXExceptionContentHandler.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 targetdata
- - the processing instruction data, or null if none was supplied. The data does not include any whitespace
separating it from the targetorg.xml.sax.SAXException
- if the Result ContentHandler throws a SAXExceptionContentHandler.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. 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]"org.xml.sax.SAXException
- if the Result ContentHandler throws a SAXExceptionContentHandler.skippedEntity(java.lang.String)
public void comment(char[] ch, int start, int length) throws org.xml.sax.SAXException
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
- if the Result LexicalHandler throws a SAXExceptionLexicalHandler.comment(char[], int, int)
public void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
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. (Note that this
is not resolved against the document base URI.)org.xml.sax.SAXException
- if the Result LexicalHandler throws a SAXExceptionLexicalHandler.startDTD(java.lang.String, java.lang.String, java.lang.String)
public void endDTD() throws org.xml.sax.SAXException
endDTD
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
- if the Result LexicalHandler throws a SAXExceptionLexicalHandler.endDTD()
public void startEntity(java.lang.String name) throws org.xml.sax.SAXException
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 '%', and if it is the external
DTD subset, it will be "[dtd]"org.xml.sax.SAXException
- if the Result LexicalHandler throws a SAXExceptionLexicalHandler.startEntity(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 endingorg.xml.sax.SAXException
- if the Result LexicalHandler throws a SAXExceptionLexicalHandler.endEntity(java.lang.String)
public void startCDATA() throws org.xml.sax.SAXException
startCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
- if the Result LexicalHandler throws a SAXExceptionLexicalHandler.startCDATA()
public void endCDATA() throws org.xml.sax.SAXException
endCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
- if the Result LexicalHandler throws a SAXExceptionLexicalHandler.endCDATA()
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 if none was given.systemId
- - the notation's system identifier, or null if none was given.org.xml.sax.SAXException
- if the Result DTDHandler throws a SAXExceptionDTDHandler.notationDecl(String, String, 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 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.org.xml.sax.SAXException
- if the Result DTDHandler throws a SAXExceptionDTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void attributeDecl(java.lang.String eName, java.lang.String aName, java.lang.String type, java.lang.String mode, java.lang.String value) throws org.xml.sax.SAXException
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.mode
- - 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.org.xml.sax.SAXException
- if the Result DeclHandler throws a SAXExceptionDeclHandler.attributeDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void elementDecl(java.lang.String name, java.lang.String model) throws org.xml.sax.SAXException
elementDecl
in interface org.xml.sax.ext.DeclHandler
name
- - the element type namemodel
- - the content model as a normalized stringorg.xml.sax.SAXException
- if the Result DeclHandler throws a SAXExceptionDeclHandler.elementDecl(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
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 entity's public identifier, or null if none was given.systemId
- - The entity's system identifier.org.xml.sax.SAXException
- if the Result DeclHandler throws a SAXExceptionDeclHandler.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)
public void internalEntityDecl(java.lang.String name, java.lang.String value) throws org.xml.sax.SAXException
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
- if the Result DeclHandler throws a SAXExceptionDeclHandler.internalEntityDecl(java.lang.String, java.lang.String)