Class XMLFilterImpl3
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler,DeclHandler,LexicalHandler,XMLFilter,XMLReader
- Direct Known Subclasses:
LexicalPreservationBase
Provides an extensible class for filtering SAX events, including lexical events such as XML comments. The class is
functionally similar to XMLFilterImpl2 but provides additional extensible methods to support the
suppression of output.
- Author:
- Anthony Smith
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe SAX event items for marking which SAX events to process. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final EnumSet<XMLFilterImpl3.SaxEventItem>Process additional information events.static final EnumSet<XMLFilterImpl3.SaxEventItem>Process all filter events.static final EnumSet<XMLFilterImpl3.SaxEventItem>Process body events.static final EnumSet<XMLFilterImpl3.SaxEventItem>Process text data events.static final EnumSet<XMLFilterImpl3.SaxEventItem>Process all declaration events.static final EnumSet<XMLFilterImpl3.SaxEventItem>Process element and attribute declaration events.static final EnumSet<XMLFilterImpl3.SaxEventItem>Process the entity and notation declaration events.static final EnumSet<XMLFilterImpl3.SaxEventItem>Process the entity declaration events.static final EnumSet<XMLFilterImpl3.SaxEventItem>Process all entity reference events (including skipped reference events).static final EnumSet<XMLFilterImpl3.SaxEventItem>Process exception events.static final EnumSet<XMLFilterImpl3.SaxEventItem>Process the events that occur in the internal subset.static final EnumSet<XMLFilterImpl3.SaxEventItem>Process normal body events. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidProcess the SAX attributeDecl event.voidcharacters(char[] ch, int start, int length) Process the SAX characters event.voidcomment(char[] ch, int start, int length) Process the SAX comment event.voidelementDecl(String name, String model) Process the SAX elementDecl event.voidendCDATA()Process the SAX endCDATA event.voidProcess the SAX endDocument event.voidendDTD()Process the SAX endDTD event.voidendElement(String uri, String localName, String qName) Process the SAX endElement event.voidProcess the SAX endEntity event.voidendPrefixMapping(String prefix) Process the SAX endPrefixMapping event.voidProcess the SAX error event.voidexternalEntityDecl(String name, String publicId, String systemId) Process the SAX externalEntityDecl event.voidProcess the SAX fatalEror event.Get a copy of the current process filter set.voidignorableWhitespace(char[] ch, int start, int length) Process the SAX ignorableWhitespace event.voidinternalEntityDecl(String name, String value) Process the SAX internalEntityDecl event.voidnotationDecl(String name, String publicId, String systemId) Process the SAX notationDecl event.booleanState whether the filter is processing the given event.voidprocessingInstruction(String target, String data) Process the SAX processingInstruction event.voidsetDocumentLocator(Locator locator) Process the SAX setDocumentLocator event.voidsetProcessFilter(XMLFilterImpl3.SaxEventItem pi, boolean process) Set whether to process a SAX event item.voidSet which SAX event items to process an item set.voidsetProcessFilter(EnumSet<XMLFilterImpl3.SaxEventItem> pis, boolean process) Set whether to process the set of SAX event items.voidskippedEntity(String name) Process the SAX skippedEntity event.voidProcess the SAX startCDATA event.voidProcess the SAX startDocument event.voidProcess the SAX startDTD event.voidstartElement(String uri, String localName, String qName, Attributes atts) Process the SAX startElement event.voidstartEntity(String name) Process the SAX startEntity event.voidstartPrefixMapping(String prefix, String uri) Process the SAX startPrefixMapping event.voidunparsedEntityDecl(String name, String publicId, String systemId, String notationName) Process the SAX unparsedEntityDecl event.voidProcess the SAX warning event.Methods inherited from class com.deltaxml.pipe.XMLFilterImpl2
getProperty, parse, parse, setPropertyMethods inherited from class org.xml.sax.helpers.XMLFilterImpl
getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParentMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
PROCESS_ALL
Process all filter events. -
PROCESS_ENTITY_DECLS
Process the entity declaration events. That is the internal parsed entity, external parsed entity and the unparsed entity events. (i.e.XMLFilterImpl3.SaxEventItem.INT_PAR_ENTITY_DECL,XMLFilterImpl3.SaxEventItem.EXT_PAR_ENTITY_DECL, andXMLFilterImpl3.SaxEventItem.UNPAR_ENTITY_DECLSAX event items). -
PROCESS_ENTITY_AND_NOTATION_DECLS
Process the entity and notation declaration events. Add theXMLFilterImpl3.SaxEventItem.NOTATION_DECLitem to the entity declarations (PROCESS_ENTITY_DECLS). -
PROCESS_ELEM_AND_ATTRIB_DECLS
Process element and attribute declaration events. That is theXMLFilterImpl3.SaxEventItem.ELEMENT_DECLandXMLFilterImpl3.SaxEventItem.ATTRIBUTE_DECLitems. -
PROCESS_DECLS
Process all declaration events. That is process entity, notation, element and attribute declarations (i.e. union ofPROCESS_ENTITY_AND_NOTATION_DECLSandPROCESS_ELEM_AND_ATTRIB_DECLS). -
PROCESS_ENTITY_REFS
Process all entity reference events (including skipped reference events). That is theXMLFilterImpl3.SaxEventItem.ENTITYandXMLFilterImpl3.SaxEventItem.SKIPPED_ENTITYitems. -
PROCESS_DATA
Process text data events. That is the CDATA, character and ignorable whitespace events (i.e.XMLFilterImpl3.SaxEventItem.CDATA,XMLFilterImpl3.SaxEventItem.CHARACTERS, andXMLFilterImpl3.SaxEventItem.IGNORABLE_WHITESPACEitems). -
PROCESS_ADDITIONAL_INFO
Process additional information events. That is location, comments and processing instruction events (i.e.XMLFilterImpl3.SaxEventItem.LOCATOR,XMLFilterImpl3.SaxEventItem.COMMENT, andXMLFilterImpl3.SaxEventItem.PROCESSING_INSTRUCTIONitems). Note that the setLocator event always precedes the startDocument event. -
PROCESS_INTERNAL_SUBSET
Process the events that occur in the internal subset. That is the declaration, entity reference, and DTD events (i.e. the union of thePROCESS_DECLSandPROCESS_ENTITY_REFSsets with theXMLFilterImpl3.SaxEventItem.DTDitem). Note that this does not include the additional information or exception events that may also appear in the internal subset. -
PROCESS_NORMAL_BODY
Process normal body events. That is the text data events and the start/stop element and prefix-mapping events (i.e. the union of thePROCESS_DATAset with theXMLFilterImpl3.SaxEventItem.ELEMENTandXMLFilterImpl3.SaxEventItem.PREFIX_MAPPINGitems. Note this set does not contain the entity reference, additional data, and exception events. -
PROCESS_BODY
Process body events. That is the text data events, the start/stop element and prefix-mapping events, and the entity reference events (i.e. the union of thePROCESS_NORMAL_BODYandPROCESS_ENTITY_REFSsets). Note this set does not contain the additional data and exception events. -
PROCESS_EXCEPTIONS
Process exception events. That is process warning, error, and fatal-error events (i.e.XMLFilterImpl3.SaxEventItem.WARNING,XMLFilterImpl3.SaxEventItem.ERRORandXMLFilterImpl3.SaxEventItem.FATAL_ERRORprocess items).
-
-
Constructor Details
-
XMLFilterImpl3
public XMLFilterImpl3()Creates a new XMLFilterImpl3.
-
-
Method Details
-
getProcessFilter
Get a copy of the current process filter set.- Returns:
- a copy of the current process filter set.
-
processEvent
State whether the filter is processing the given event.- Parameters:
pi- The SAX event item.- Returns:
- Whether this item should be processed.
-
setProcessFilter
Set whether to process a SAX event item.- Parameters:
pi- The process item.process- Whether to add (true) or remove the item from this object's current process filter set.
-
setProcessFilter
Set whether to process the set of SAX event items. This effectively performs a union or set difference operation on this object's current process filter set, depending on whether theprocessparameter is set to true or false respectively.- Parameters:
pis- A set of SAX event items.process- Whether to add (true) or remove items from this object's current process filter set.
-
setProcessFilter
Set which SAX event items to process an item set. This replaces this object's current process filter set.- Parameters:
pis- The set of SAX event items to process.
-
setDocumentLocator
Process the SAX setDocumentLocator event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.LOCATORelement, then the parent'ssetDocumentLocatoris invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
setDocumentLocatorin interfaceContentHandler- Overrides:
setDocumentLocatorin classXMLFilterImpl- Parameters:
locator- the document locator.
-
startDocument
Process the SAX startDocument event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.DOCUMENTelement, then the parent'sstartDocumentis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classXMLFilterImpl- Throws:
SAXException- when there is a SAX error.
-
endDocument
Process the SAX endDocument event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.DOCUMENTelement, then the parent'sendDocumentis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin classXMLFilterImpl- Throws:
SAXException- when there is a SAX error.
-
startDTD
Process the SAX startDTD event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.DTDelement, then the parent'sstartDTDis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
startDTDin interfaceLexicalHandler- Overrides:
startDTDin classXMLFilterImpl2- Parameters:
name- root element namepublicId- the optional public document idsystemId- the optional system document id- Throws:
SAXException- when there is a SAX error.- See Also:
-
endDTD
Process the SAX endDTD event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.DTDelement, then the parent'sendDTDis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
endDTDin interfaceLexicalHandler- Overrides:
endDTDin classXMLFilterImpl2- Throws:
SAXException- when there is a SAX error.- See Also:
-
elementDecl
Process the SAX elementDecl event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.ELEMENT_DECLelement, then the parent'selementDeclis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
elementDeclin interfaceDeclHandler- Overrides:
elementDeclin classXMLFilterImpl2- Parameters:
name- the element namemodel- the elements/data that this element can contain- Throws:
SAXException- when there is a SAX error.- See Also:
-
attributeDecl
public void attributeDecl(String eName, String aName, String type, String mode, String value) throws SAXException Process the SAX attributeDecl event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.ATTRIBUTE_DECLelement, then the parent'sattributeDeclis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
attributeDeclin interfaceDeclHandler- Overrides:
attributeDeclin classXMLFilterImpl2- Parameters:
eName- the name of the associated element.aName- the name of the attributetype- the attribute's typemode- the attribute's modevalue- the attribute's value- Throws:
SAXException- when there is a SAX error.- See Also:
-
internalEntityDecl
Process the SAX internalEntityDecl event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.INT_PAR_ENTITY_DECLelement, then the parent'sinternalEntityDeclis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
internalEntityDeclin interfaceDeclHandler- Overrides:
internalEntityDeclin classXMLFilterImpl2- Parameters:
name- the entity's modevalue- the entity's value- Throws:
SAXException- when there is a SAX error.- See Also:
-
externalEntityDecl
Process the SAX externalEntityDecl event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.EXT_PAR_ENTITY_DECLelement, then the parent'sexternalEntityDeclis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
externalEntityDeclin interfaceDeclHandler- Overrides:
externalEntityDeclin classXMLFilterImpl2- Parameters:
name- the entity's namepublicId- the entity's public identifiersystemId- the entity's system identifier- Throws:
SAXException- when there is a SAX error.- See Also:
-
unparsedEntityDecl
public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException Process the SAX unparsedEntityDecl event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.UNPAR_ENTITY_DECLelement, then the parent'sunparsedEntityDeclis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
unparsedEntityDeclin interfaceDTDHandler- Overrides:
unparsedEntityDeclin classXMLFilterImpl- Parameters:
name- the entity's namepublicId- the entity's public identifiersystemId- the entity's system identifiernotationName- the entity's notation- Throws:
SAXException- when there is a SAX error.
-
notationDecl
Process the SAX notationDecl event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.NOTATION_DECLelement, then the parent'snotationDeclis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
notationDeclin interfaceDTDHandler- Overrides:
notationDeclin classXMLFilterImpl- Parameters:
name- the notation namepublicId- the notation public identifiersystemId- the notation system identifier- Throws:
SAXException- when there is a SAX error.
-
startEntity
Process the SAX startEntity event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.ENTITYelement, then the parent'sstartEntityis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
startEntityin interfaceLexicalHandler- Overrides:
startEntityin classXMLFilterImpl2- Parameters:
name- the name of the entity being referenced.- Throws:
SAXException- when there is a SAX error.- See Also:
-
endEntity
Process the SAX endEntity event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.ENTITYelement, then the parent'sendEntityis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
endEntityin interfaceLexicalHandler- Overrides:
endEntityin classXMLFilterImpl2- Parameters:
name- the name of the entity being referenced.- Throws:
SAXException- when there is a SAX error.- See Also:
-
skippedEntity
Process the SAX skippedEntity event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.SKIPPED_ENTITYelement, then the parent'sskippedEntityis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
skippedEntityin interfaceContentHandler- Overrides:
skippedEntityin classXMLFilterImpl- Parameters:
name- the name of the entity being skipped.- Throws:
SAXException- when there is a SAX error.
-
startCDATA
Process the SAX startCDATA event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.CDATAelement, then the parent'sstartCDATAis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
startCDATAin interfaceLexicalHandler- Overrides:
startCDATAin classXMLFilterImpl2- Throws:
SAXException- when there is a SAX error.- See Also:
-
endCDATA
Process the SAX endCDATA event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.CDATAelement, then the parent'sendCDATAis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
endCDATAin interfaceLexicalHandler- Overrides:
endCDATAin classXMLFilterImpl2- Throws:
SAXException- when there is a SAX error.- See Also:
-
characters
Process the SAX characters event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.CHARACTERSelement, then the parent'scharactersis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classXMLFilterImpl- Parameters:
ch- characters an array of charactersstart- the starting character positionlength- the number of characters to process- Throws:
SAXException- when there is a SAX error.
-
ignorableWhitespace
Process the SAX ignorableWhitespace event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.IGNORABLE_WHITESPACEelement, then the parent'signorableWhitespaceis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
ignorableWhitespacein interfaceContentHandler- Overrides:
ignorableWhitespacein classXMLFilterImpl- Parameters:
ch- characters an array of charactersstart- the starting character positionlength- the number of characters to process- Throws:
SAXException- when there is a SAX error.
-
comment
Process the SAX comment event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.COMMENTelement, then the parent'scommentis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
commentin interfaceLexicalHandler- Overrides:
commentin classXMLFilterImpl2- Parameters:
ch- characters an array of charactersstart- the starting character positionlength- the number of characters to process- Throws:
SAXException- when there is a SAX error.- See Also:
-
processingInstruction
Process the SAX processingInstruction event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.PROCESSING_INSTRUCTIONelement, then the parent'sprocessingInstructionis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
processingInstructionin interfaceContentHandler- Overrides:
processingInstructionin classXMLFilterImpl- Parameters:
target- the name of the processing instructiondata- the content of the processing instruction- Throws:
SAXException- when there is a SAX error.
-
startElement
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException Process the SAX startElement event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.ELEMENTelement, then the parent'sstartElementis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classXMLFilterImpl- Parameters:
uri- the element's UTIlocalName- the element's local nameqName- the element's qualified nameatts- the elements attributes- Throws:
SAXException- when there is a SAX error.
-
endElement
Process the SAX endElement event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.ELEMENTelement, then the parent'sendElementis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classXMLFilterImpl- Parameters:
uri- the element's UTIlocalName- the element's local nameqName- the element's qualified name- Throws:
SAXException- when there is a SAX error.
-
startPrefixMapping
Process the SAX startPrefixMapping event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.PREFIX_MAPPINGelement, then the parent'sstartPrefixMappingis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
startPrefixMappingin interfaceContentHandler- Overrides:
startPrefixMappingin classXMLFilterImpl- Parameters:
prefix- the namespace prefixuri- the namespace URI- Throws:
SAXException- when there is a SAX error.
-
endPrefixMapping
Process the SAX endPrefixMapping event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.PREFIX_MAPPINGelement, then the parent'sendPrefixMappingis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
endPrefixMappingin interfaceContentHandler- Overrides:
endPrefixMappingin classXMLFilterImpl- Parameters:
prefix- the namespace prefix- Throws:
SAXException- when there is a SAX error.
-
warning
Process the SAX warning event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.WARNINGelement, then the parent'swarningis invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
warningin interfaceErrorHandler- Overrides:
warningin classXMLFilterImpl- Parameters:
e- a parse exception.- Throws:
SAXException- when there is a SAX error.
-
error
Process the SAX error event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.ERRORelement, then the parent'serroris invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
errorin interfaceErrorHandler- Overrides:
errorin classXMLFilterImpl- Parameters:
e- a parse exception.- Throws:
SAXException- when there is a SAX error.
-
fatalError
Process the SAX fatalEror event.When this object's process filter set contains a
XMLFilterImpl3.SaxEventItem.FATAL_ERRORelement, then the parent'sfatalErroris invoked before this method returns. In all other cases this method returns without doing anything.- Specified by:
fatalErrorin interfaceErrorHandler- Overrides:
fatalErrorin classXMLFilterImpl- Parameters:
e- a parse exception.- Throws:
SAXException- when there is a SAX error.
-