Package com.deltaxml.pipe
Class XMLPushFilterImpl
java.lang.Object
com.deltaxml.pipe.XMLPushFilterImpl
- All Implemented Interfaces:
XMLPushFilter,ContentHandler,DTDHandler,DeclHandler,LexicalHandler
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAn implementation of the DeclHandler attributeDecl method.voidcharacters(char[] ch, int start, int length) An extensible implementation of the ContentHandler characters method.voidcomment(char[] ch, int start, int length) An extensible implementation of the LexicalHandler comment method.voidelementDecl(String name, String model) An implementation of the DeclHandler elementDecl method.voidendCDATA()An extensible implementation of the LexicalHandler endCDATA method.voidAn extensible implementation of the ContentHandler endDocument method.voidendDTD()An extensible implementation of the LexicalHandler endDTD method.voidendElement(String uri, String localName, String qName) An extensible implementation of the ContentHandler endElement method.voidAn extensible implementation of the LexicalHandler endEntity method.voidendPrefixMapping(String prefix) An extensible implementation of the ContentHandler endPrefixMapping method.voidexternalEntityDecl(String name, String publicId, String systemId) An implementation of the DeclHandler externalEntityDecl method.voidignorableWhitespace(char[] ch, int start, int length) An extensible implementation of the ContentHandler ignorableWhitespace method.voidinternalEntityDecl(String name, String value) An implementation of the DeclHandler internalEntityDecl method.voidnotationDecl(String name, String publicId, String systemId) Filter a notationDecl event.voidprocessingInstruction(String target, String data) An extensible implementation of the ContentHandler processingInstruction method.voidsetDocumentLocator(Locator locator) An extensible implementation of the ContentHandler setDocumentLocator method.voidEnables the user to set the Result of the transformation.voidskippedEntity(String name) An extensible implementation of the ContentHandler skippedEntity method.voidAn extensible implementation of the LexicalHandler startCDATA method.voidAn extensible implementation of the ContentHandler startDocument method.voidAn extensible implementation of the LexicalHandler startDTD method.voidstartElement(String uri, String localName, String qName, Attributes atts) An extensible implementation of the ContentHandler startElement method.voidstartEntity(String name) An extensible implementation of the LexicalHandler startEntity method.voidstartPrefixMapping(String prefix, String uri) An extensible implementation of the ContentHandler startPrefixMapping method.voidunparsedEntityDecl(String name, String publicId, String systemId, String notationName) An extensible implementation of the DTDHandler unparsedEntityDecl method.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandler
declaration
-
Constructor Details
-
XMLPushFilterImpl
public XMLPushFilterImpl()Create a new instance of XMLPushFilterImpl.
-
-
Method Details
-
setResult
Enables the user to set the Result of the transformation.- Specified by:
setResultin interfaceXMLPushFilter- Parameters:
result- a Result instance. Should not be null.- Throws:
IllegalArgumentException- if the parameter is null- See Also:
-
setDocumentLocator
An extensible implementation of the ContentHandler setDocumentLocator method.- Specified by:
setDocumentLocatorin interfaceContentHandler- Parameters:
locator- - an object that can return the location of any SAX document event- See Also:
-
startDocument
An extensible implementation of the ContentHandler startDocument method.- Specified by:
startDocumentin interfaceContentHandler- Throws:
SAXException- if the Result ContentHandler throws a SAXException- See Also:
-
endDocument
An extensible implementation of the ContentHandler endDocument method.- Specified by:
endDocumentin interfaceContentHandler- Throws:
SAXException- if the Result ContentHandler throws a SAXException- See Also:
-
startPrefixMapping
An extensible implementation of the ContentHandler startPrefixMapping method.- Specified by:
startPrefixMappingin interfaceContentHandler- Parameters:
prefix- - the namespace prefixuri- - the namespace URI- Throws:
SAXException- if the Result ContentHandler throws a SAXException- See Also:
-
endPrefixMapping
An extensible implementation of the ContentHandler endPrefixMapping method.- Specified by:
endPrefixMappingin interfaceContentHandler- Parameters:
prefix- - the namespace prefix- Throws:
SAXException- if the Result ContentHandler throws a SAXException- See Also:
-
startElement
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException An extensible implementation of the ContentHandler startElement method.- Specified by:
startElementin interfaceContentHandler- Parameters:
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 undefined- Throws:
SAXException- if the Result ContentHandler throws a SAXException- See Also:
-
endElement
An extensible implementation of the ContentHandler endElement method.- Specified by:
endElementin interfaceContentHandler- Parameters:
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 available- Throws:
SAXException- if the Result ContentHandler throws a SAXException- See Also:
-
characters
An extensible implementation of the ContentHandler characters method.- Specified by:
charactersin interfaceContentHandler- Parameters:
ch- - the characters from the XML documentstart- - the start position in the arraylength- - the number of characters to read from the array- Throws:
SAXException- if the Result ContentHandler throws a SAXException- See Also:
-
ignorableWhitespace
An extensible implementation of the ContentHandler ignorableWhitespace method.- Specified by:
ignorableWhitespacein interfaceContentHandler- Parameters:
ch- - the characters from the XML documentstart- - the start position in the arraylength- - the number of characters to read from the array- Throws:
SAXException- if the Result ContentHandler throws a SAXException- See Also:
-
processingInstruction
An extensible implementation of the ContentHandler processingInstruction method.- Specified by:
processingInstructionin interfaceContentHandler- Parameters:
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 target- Throws:
SAXException- if the Result ContentHandler throws a SAXException- See Also:
-
skippedEntity
An extensible implementation of the ContentHandler skippedEntity method.- Specified by:
skippedEntityin interfaceContentHandler- 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- if the Result ContentHandler throws a SAXException- See Also:
-
comment
An extensible implementation of the LexicalHandler comment method.- Specified by:
commentin interfaceLexicalHandler- 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- if the Result LexicalHandler throws a SAXException- See Also:
-
startDTD
An extensible implementation of the LexicalHandler startDTD method.- Specified by:
startDTDin interfaceLexicalHandler- 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- if the Result LexicalHandler throws a SAXException- See Also:
-
endDTD
An extensible implementation of the LexicalHandler endDTD method.- Specified by:
endDTDin interfaceLexicalHandler- Throws:
SAXException- if the Result LexicalHandler throws a SAXException- See Also:
-
startEntity
An extensible implementation of the LexicalHandler startEntity method.- Specified by:
startEntityin interfaceLexicalHandler- 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- if the Result LexicalHandler throws a SAXException- See Also:
-
endEntity
An extensible implementation of the LexicalHandler endEntity method.- Specified by:
endEntityin interfaceLexicalHandler- Parameters:
name- - the name of the entity that is ending- Throws:
SAXException- if the Result LexicalHandler throws a SAXException- See Also:
-
startCDATA
An extensible implementation of the LexicalHandler startCDATA method.- Specified by:
startCDATAin interfaceLexicalHandler- Throws:
SAXException- if the Result LexicalHandler throws a SAXException- See Also:
-
endCDATA
An extensible implementation of the LexicalHandler endCDATA method.- Specified by:
endCDATAin interfaceLexicalHandler- Throws:
SAXException- if the Result LexicalHandler throws a SAXException- See Also:
-
notationDecl
Filter a notationDecl event. While this method does filter the event it is likely that upstream processes, which subsequently receive the event may not do anything meaningful. For example if the events are sent to a SAX event serializer or the setResult method uses a StreamResult argument then the notation declaration may be lost and not appear in any output.- Specified by:
notationDeclin interfaceDTDHandler- 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- if the Result DTDHandler throws a SAXException- See Also:
-
unparsedEntityDecl
public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException An extensible implementation of the DTDHandler unparsedEntityDecl method.- Specified by:
unparsedEntityDeclin interfaceDTDHandler- 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- if the Result DTDHandler throws a SAXException- See Also:
-
attributeDecl
public void attributeDecl(String eName, String aName, String type, String mode, String value) throws SAXException An implementation of the DeclHandler attributeDecl method.- Specified by:
attributeDeclin interfaceDeclHandler- Parameters:
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.- Throws:
SAXException- if the Result DeclHandler throws a SAXException- See Also:
-
elementDecl
An implementation of the DeclHandler elementDecl method.- Specified by:
elementDeclin interfaceDeclHandler- Parameters:
name- - the element type namemodel- - the content model as a normalized string- Throws:
SAXException- if the Result DeclHandler throws a SAXException- See Also:
-
externalEntityDecl
An implementation of the DeclHandler externalEntityDecl method.- Specified by:
externalEntityDeclin interfaceDeclHandler- 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- if the Result DeclHandler throws a SAXException- See Also:
-
internalEntityDecl
An implementation of the DeclHandler internalEntityDecl method.- Specified by:
internalEntityDeclin interfaceDeclHandler- 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- if the Result DeclHandler throws a SAXException- See Also:
-