public class XMLFilterImpl3 extends XMLFilterImpl2 implements org.xml.sax.DTDHandler
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
XMLFilterImpl3.SaxEventItem
The SAX event items for marking which SAX events to process.
|
| Modifier and Type | Field and Description |
|---|---|
static java.util.EnumSet<XMLFilterImpl3.SaxEventItem> |
PROCESS_ADDITIONAL_INFO
Process additional information events.
|
static java.util.EnumSet<XMLFilterImpl3.SaxEventItem> |
PROCESS_ALL
Process all filter events.
|
static java.util.EnumSet<XMLFilterImpl3.SaxEventItem> |
PROCESS_BODY
Process body events.
|
static java.util.EnumSet<XMLFilterImpl3.SaxEventItem> |
PROCESS_DATA
Process text data events.
|
static java.util.EnumSet<XMLFilterImpl3.SaxEventItem> |
PROCESS_DECLS
Process all declaration events.
|
static java.util.EnumSet<XMLFilterImpl3.SaxEventItem> |
PROCESS_ELEM_AND_ATTRIB_DECLS
Process element and attribute declaration events.
|
static java.util.EnumSet<XMLFilterImpl3.SaxEventItem> |
PROCESS_ENTITY_AND_NOTATION_DECLS
Process the entity and notation declaration events.
|
static java.util.EnumSet<XMLFilterImpl3.SaxEventItem> |
PROCESS_ENTITY_DECLS
Process the entity declaration events.
|
static java.util.EnumSet<XMLFilterImpl3.SaxEventItem> |
PROCESS_ENTITY_REFS
Process all entity reference events (including skipped reference events).
|
static java.util.EnumSet<XMLFilterImpl3.SaxEventItem> |
PROCESS_EXCEPTIONS
Process exception events.
|
static java.util.EnumSet<XMLFilterImpl3.SaxEventItem> |
PROCESS_INTERNAL_SUBSET
Process the events that occur in the internal subset.
|
static java.util.EnumSet<XMLFilterImpl3.SaxEventItem> |
PROCESS_NORMAL_BODY
Process normal body events.
|
| Constructor and Description |
|---|
XMLFilterImpl3()
Creates a new XMLFilterImpl3.
|
| 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)
Process the SAX attributeDecl event.
|
void |
characters(char[] ch,
int start,
int length)
Process the SAX characters event.
|
void |
comment(char[] ch,
int start,
int length)
Process the SAX comment event.
|
void |
elementDecl(java.lang.String name,
java.lang.String model)
Process the SAX elementDecl event.
|
void |
endCDATA()
Process the SAX endCDATA event.
|
void |
endDocument()
Process the SAX endDocument event.
|
void |
endDTD()
Process the SAX endDTD event.
|
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
Process the SAX endElement event.
|
void |
endEntity(java.lang.String name)
Process the SAX endEntity event.
|
void |
endPrefixMapping(java.lang.String prefix)
Process the SAX endPrefixMapping event.
|
void |
error(org.xml.sax.SAXParseException e)
Process the SAX error event.
|
void |
externalEntityDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Process the SAX externalEntityDecl event.
|
void |
fatalError(org.xml.sax.SAXParseException e)
Process the SAX fatalEror event.
|
java.util.EnumSet<XMLFilterImpl3.SaxEventItem> |
getProcessFilter()
Get a copy of the current process filter set.
|
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Process the SAX ignorableWhitespace event.
|
void |
internalEntityDecl(java.lang.String name,
java.lang.String value)
Process the SAX internalEntityDecl event.
|
void |
notationDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Process the SAX notationDecl event.
|
boolean |
processEvent(XMLFilterImpl3.SaxEventItem pi)
State whether the filter is processing the given event.
|
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Process the SAX processingInstruction event.
|
void |
setDocumentLocator(org.xml.sax.Locator locator)
Process the SAX setDocumentLocator event.
|
void |
setProcessFilter(java.util.EnumSet<XMLFilterImpl3.SaxEventItem> pis)
Set which SAX event items to process an item set.
|
void |
setProcessFilter(java.util.EnumSet<XMLFilterImpl3.SaxEventItem> pis,
boolean process)
Set whether to process the set of SAX event items.
|
void |
setProcessFilter(XMLFilterImpl3.SaxEventItem pi,
boolean process)
Set whether to process a SAX event item.
|
void |
skippedEntity(java.lang.String name)
Process the SAX skippedEntity event.
|
void |
startCDATA()
Process the SAX startCDATA event.
|
void |
startDocument()
Process the SAX startDocument event.
|
void |
startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Process the SAX startDTD event.
|
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
Process the SAX startElement event.
|
void |
startEntity(java.lang.String name)
Process the SAX startEntity event.
|
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
Process the SAX startPrefixMapping event.
|
void |
unparsedEntityDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId,
java.lang.String notationName)
Process the SAX unparsedEntityDecl event.
|
void |
warning(org.xml.sax.SAXParseException e)
Process the SAX warning event.
|
getProperty, parse, parse, setPropertypublic static final java.util.EnumSet<XMLFilterImpl3.SaxEventItem> PROCESS_ALL
public static final java.util.EnumSet<XMLFilterImpl3.SaxEventItem> PROCESS_ENTITY_DECLS
XMLFilterImpl3.SaxEventItem.INT_PAR_ENTITY_DECL, XMLFilterImpl3.SaxEventItem.EXT_PAR_ENTITY_DECL, and
XMLFilterImpl3.SaxEventItem.UNPAR_ENTITY_DECL SAX event items).public static final java.util.EnumSet<XMLFilterImpl3.SaxEventItem> PROCESS_ENTITY_AND_NOTATION_DECLS
XMLFilterImpl3.SaxEventItem.NOTATION_DECL item to the entity
declarations ( XMLFilterImpl3.PROCESS_ENTITY_DECLS).public static final java.util.EnumSet<XMLFilterImpl3.SaxEventItem> PROCESS_ELEM_AND_ATTRIB_DECLS
XMLFilterImpl3.SaxEventItem.ELEMENT_DECL and
XMLFilterImpl3.SaxEventItem.ATTRIBUTE_DECL items.public static final java.util.EnumSet<XMLFilterImpl3.SaxEventItem> PROCESS_DECLS
XMLFilterImpl3.PROCESS_ENTITY_AND_NOTATION_DECLS and XMLFilterImpl3.PROCESS_ELEM_AND_ATTRIB_DECLS).public static final java.util.EnumSet<XMLFilterImpl3.SaxEventItem> PROCESS_ENTITY_REFS
XMLFilterImpl3.SaxEventItem.ENTITY and
XMLFilterImpl3.SaxEventItem.SKIPPED_ENTITY items.public static final java.util.EnumSet<XMLFilterImpl3.SaxEventItem> PROCESS_DATA
XMLFilterImpl3.SaxEventItem.CDATA,
XMLFilterImpl3.SaxEventItem.CHARACTERS, and XMLFilterImpl3.SaxEventItem.IGNORABLE_WHITESPACE items).public static final java.util.EnumSet<XMLFilterImpl3.SaxEventItem> PROCESS_ADDITIONAL_INFO
XMLFilterImpl3.SaxEventItem.LOCATOR, XMLFilterImpl3.SaxEventItem.COMMENT, and XMLFilterImpl3.SaxEventItem.PROCESSING_INSTRUCTION items). Note that
the setLocator event always precedes the startDocument event.public static final java.util.EnumSet<XMLFilterImpl3.SaxEventItem> PROCESS_INTERNAL_SUBSET
XMLFilterImpl3.PROCESS_DECLS and XMLFilterImpl3.PROCESS_ENTITY_REFS sets with the XMLFilterImpl3.SaxEventItem.DTD item). Note that
this does not include the additional information or exception events that may also appear in the internal subset.public static final java.util.EnumSet<XMLFilterImpl3.SaxEventItem> PROCESS_NORMAL_BODY
XMLFilterImpl3.PROCESS_DATA set with the XMLFilterImpl3.SaxEventItem.ELEMENT and XMLFilterImpl3.SaxEventItem.PREFIX_MAPPING items. Note
this set does not contain the entity reference, additional data, and exception events.public static final java.util.EnumSet<XMLFilterImpl3.SaxEventItem> PROCESS_BODY
XMLFilterImpl3.PROCESS_NORMAL_BODY and XMLFilterImpl3.PROCESS_ENTITY_REFS sets). Note this set does not
contain the additional data and exception events.public static final java.util.EnumSet<XMLFilterImpl3.SaxEventItem> PROCESS_EXCEPTIONS
XMLFilterImpl3.SaxEventItem.WARNING,
XMLFilterImpl3.SaxEventItem.ERROR and XMLFilterImpl3.SaxEventItem.FATAL_ERROR process items).public java.util.EnumSet<XMLFilterImpl3.SaxEventItem> getProcessFilter()
public boolean processEvent(XMLFilterImpl3.SaxEventItem pi)
pi - The SAX event item.public void setProcessFilter(XMLFilterImpl3.SaxEventItem pi, boolean process)
pi - The process item.process - Whether to add (true) or remove the item from this object's current process filter set.public void setProcessFilter(java.util.EnumSet<XMLFilterImpl3.SaxEventItem> pis, boolean process)
process parameter is set to true or false
respectively.pis - A set of SAX event items.process - Whether to add (true) or remove items from this object's current process filter set.public void setProcessFilter(java.util.EnumSet<XMLFilterImpl3.SaxEventItem> pis)
pis - The set of SAX event items to process.public void setDocumentLocator(org.xml.sax.Locator locator)
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.LOCATOR element, then the parent's
setDocumentLocator is invoked before this method returns. In all other cases this method returns without doing
anything.
setDocumentLocator in interface org.xml.sax.ContentHandlersetDocumentLocator in class org.xml.sax.helpers.XMLFilterImpllocator - the document locator.public void startDocument()
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.DOCUMENT element, then the parent's
startDocument is invoked before this method returns. In all other cases this method returns without doing
anything.
startDocument in interface org.xml.sax.ContentHandlerstartDocument in class org.xml.sax.helpers.XMLFilterImplorg.xml.sax.SAXException - when there is a SAX error.public void endDocument()
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.DOCUMENT element, then the parent's
endDocument is invoked before this method returns. In all other cases this method returns without doing
anything.
endDocument in interface org.xml.sax.ContentHandlerendDocument in class org.xml.sax.helpers.XMLFilterImplorg.xml.sax.SAXException - when there is a SAX error.public void startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.DTD element, then the parent's startDTD is
invoked before this method returns. In all other cases this method returns without doing anything.
startDTD in interface org.xml.sax.ext.LexicalHandlerstartDTD in class XMLFilterImpl2name - root element namepublicId - the optional public document idsystemId - the optional system document idorg.xml.sax.SAXException - when there is a SAX error.LexicalHandler.startDTD(String, String, String)public void endDTD()
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.DTD element, then the parent's endDTD is
invoked before this method returns. In all other cases this method returns without doing anything.
endDTD in interface org.xml.sax.ext.LexicalHandlerendDTD in class XMLFilterImpl2org.xml.sax.SAXException - when there is a SAX error.LexicalHandler.startDTD(String, String, String)public void elementDecl(java.lang.String name,
java.lang.String model)
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.ELEMENT_DECL element, then the parent's
elementDecl is invoked before this method returns. In all other cases this method returns without doing
anything.
elementDecl in interface org.xml.sax.ext.DeclHandlerelementDecl in class XMLFilterImpl2name - the element namemodel - the elements/data that this element can containorg.xml.sax.SAXException - when there is a SAX error.DeclHandler.elementDecl(String, 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
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.ATTRIBUTE_DECL element, then the parent's
attributeDecl is invoked before this method returns. In all other cases this method returns without doing
anything.
attributeDecl in interface org.xml.sax.ext.DeclHandlerattributeDecl in class XMLFilterImpl2eName - the name of the associated element.aName - the name of the attributetype - the attribute's typemode - the attribute's modevalue - the attribute's valueorg.xml.sax.SAXException - when there is a SAX error.DeclHandler.attributeDecl(String, String, String, String, String)public void internalEntityDecl(java.lang.String name,
java.lang.String value)
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.INT_PAR_ENTITY_DECL element, then the parent's
internalEntityDecl is invoked before this method returns. In all other cases this method returns without doing
anything.
internalEntityDecl in interface org.xml.sax.ext.DeclHandlerinternalEntityDecl in class XMLFilterImpl2name - the entity's modevalue - the entity's valueorg.xml.sax.SAXException - when there is a SAX error.DeclHandler.internalEntityDecl(String, String)public void externalEntityDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.EXT_PAR_ENTITY_DECL element, then the parent's
externalEntityDecl is invoked before this method returns. In all other cases this method returns without doing
anything.
externalEntityDecl in interface org.xml.sax.ext.DeclHandlerexternalEntityDecl in class XMLFilterImpl2name - the entity's namepublicId - the entity's public identifiersystemId - the entity's system identifierorg.xml.sax.SAXException - when there is a SAX error.DeclHandler.externalEntityDecl(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
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.UNPAR_ENTITY_DECL element, then the parent's
unparsedEntityDecl is invoked before this method returns. In all other cases this method returns without doing
anything.
unparsedEntityDecl in interface org.xml.sax.DTDHandlerunparsedEntityDecl in class org.xml.sax.helpers.XMLFilterImplname - the entity's namepublicId - the entity's public identifiersystemId - the entity's system identifiernotationName - the entity's notationorg.xml.sax.SAXException - when there is a SAX error.public void notationDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.NOTATION_DECL element, then the parent's
notationDecl is invoked before this method returns. In all other cases this method returns without doing
anything.
notationDecl in interface org.xml.sax.DTDHandlernotationDecl in class org.xml.sax.helpers.XMLFilterImplname - the notation namepublicId - the notation public identifiersystemId - the notation system identifierorg.xml.sax.SAXException - when there is a SAX error.public void startEntity(java.lang.String name)
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.ENTITY element, then the parent's
startEntity is invoked before this method returns. In all other cases this method returns without doing
anything.
startEntity in interface org.xml.sax.ext.LexicalHandlerstartEntity in class XMLFilterImpl2name - the name of the entity being referenced.org.xml.sax.SAXException - when there is a SAX error.LexicalHandler.startEntity(String)public void endEntity(java.lang.String name)
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.ENTITY element, then the parent's
endEntity is invoked before this method returns. In all other cases this method returns without doing anything.
endEntity in interface org.xml.sax.ext.LexicalHandlerendEntity in class XMLFilterImpl2name - the name of the entity being referenced.org.xml.sax.SAXException - when there is a SAX error.LexicalHandler.endEntity(String)public void skippedEntity(java.lang.String name)
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.SKIPPED_ENTITY element, then the parent's
skippedEntity is invoked before this method returns. In all other cases this method returns without doing
anything.
skippedEntity in interface org.xml.sax.ContentHandlerskippedEntity in class org.xml.sax.helpers.XMLFilterImplname - the name of the entity being skipped.org.xml.sax.SAXException - when there is a SAX error.public void startCDATA()
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.CDATA element, then the parent's
startCDATA is invoked before this method returns. In all other cases this method returns without doing anything.
startCDATA in interface org.xml.sax.ext.LexicalHandlerstartCDATA in class XMLFilterImpl2org.xml.sax.SAXException - when there is a SAX error.LexicalHandler.startCDATA(),
ContentHandler.characters(char[], int, int)public void endCDATA()
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.CDATA element, then the parent's endCDATA
is invoked before this method returns. In all other cases this method returns without doing anything.
endCDATA in interface org.xml.sax.ext.LexicalHandlerendCDATA in class XMLFilterImpl2org.xml.sax.SAXException - when there is a SAX error.LexicalHandler.endCDATA(),
ContentHandler.characters(char[], int, int)public void characters(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.CHARACTERS element, then the parent's
characters is invoked before this method returns. In all other cases this method returns without doing anything.
characters in interface org.xml.sax.ContentHandlercharacters in class org.xml.sax.helpers.XMLFilterImplch - characters an array of charactersstart - the starting character positionlength - the number of characters to processorg.xml.sax.SAXException - when there is a SAX error.public void ignorableWhitespace(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.IGNORABLE_WHITESPACE element, then the parent's
ignorableWhitespace is invoked before this method returns. In all other cases this method returns without doing
anything.
ignorableWhitespace in interface org.xml.sax.ContentHandlerignorableWhitespace in class org.xml.sax.helpers.XMLFilterImplch - characters an array of charactersstart - the starting character positionlength - the number of characters to processorg.xml.sax.SAXException - when there is a SAX error.public void comment(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.COMMENT element, then the parent's comment
is invoked before this method returns. In all other cases this method returns without doing anything.
comment in interface org.xml.sax.ext.LexicalHandlercomment in class XMLFilterImpl2ch - characters an array of charactersstart - the starting character positionlength - the number of characters to processorg.xml.sax.SAXException - when there is a SAX error.LexicalHandler.comment(char[], int, int)public void processingInstruction(java.lang.String target,
java.lang.String data)
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.PROCESSING_INSTRUCTION element, then the parent's
processingInstruction is invoked before this method returns. In all other cases this method returns without
doing anything.
processingInstruction in interface org.xml.sax.ContentHandlerprocessingInstruction in class org.xml.sax.helpers.XMLFilterImpltarget - the name of the processing instructiondata - the content of the processing instructionorg.xml.sax.SAXException - when there is a SAX error.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
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.ELEMENT element, then the parent's
startElement is invoked before this method returns. In all other cases this method returns without doing
anything.
startElement in interface org.xml.sax.ContentHandlerstartElement in class org.xml.sax.helpers.XMLFilterImpluri - the element's UTIlocalName - the element's local nameqName - the element's qualified nameatts - the elements attributesorg.xml.sax.SAXException - when there is a SAX error.public void endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.ELEMENT element, then the parent's
endElement is invoked before this method returns. In all other cases this method returns without doing anything.
endElement in interface org.xml.sax.ContentHandlerendElement in class org.xml.sax.helpers.XMLFilterImpluri - the element's UTIlocalName - the element's local nameqName - the element's qualified nameorg.xml.sax.SAXException - when there is a SAX error.public void startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.PREFIX_MAPPING element, then the parent's
startPrefixMapping is invoked before this method returns. In all other cases this method returns without doing
anything.
startPrefixMapping in interface org.xml.sax.ContentHandlerstartPrefixMapping in class org.xml.sax.helpers.XMLFilterImplprefix - the namespace prefixuri - the namespace URIorg.xml.sax.SAXException - when there is a SAX error.public void endPrefixMapping(java.lang.String prefix)
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.PREFIX_MAPPING element, then the parent's
endPrefixMapping is invoked before this method returns. In all other cases this method returns without doing
anything.
endPrefixMapping in interface org.xml.sax.ContentHandlerendPrefixMapping in class org.xml.sax.helpers.XMLFilterImplprefix - the namespace prefixorg.xml.sax.SAXException - when there is a SAX error.public void warning(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.WARNING element, then the parent's warning
is invoked before this method returns. In all other cases this method returns without doing anything.
warning in interface org.xml.sax.ErrorHandlerwarning in class org.xml.sax.helpers.XMLFilterImple - a parse exception.org.xml.sax.SAXException - when there is a SAX error.public void error(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.ERROR element, then the parent's error is
invoked before this method returns. In all other cases this method returns without doing anything.
error in interface org.xml.sax.ErrorHandlererror in class org.xml.sax.helpers.XMLFilterImple - a parse exception.org.xml.sax.SAXException - when there is a SAX error.public void fatalError(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
When this object's process filter set contains a XMLFilterImpl3.SaxEventItem.FATAL_ERROR element, then the parent's
fatalError is invoked before this method returns. In all other cases this method returns without doing anything.
fatalError in interface org.xml.sax.ErrorHandlerfatalError in class org.xml.sax.helpers.XMLFilterImple - a parse exception.org.xml.sax.SAXException - when there is a SAX error.