public class XMLFilterImpl2
extends org.xml.sax.helpers.XMLFilterImpl
implements org.xml.sax.ext.DeclHandler, org.xml.sax.ext.LexicalHandler
Provides an extensible class for filtering SAX events, including lexical events such as XML comments. The class is
functionally similar to XMLFilterImpl
but provides additional extensible methods to support the
LexicalHandler
and DeclHandler
interfaces. The class name follows the naming
scheme used in the SAX 2.0.2 release, for the extended classes such as DefaultHandler2
.
The default action of a method, unless overridden, is to copy input events to the output. In some respects this behaviour is similar to the XSLT identity transform.
This class will attempt to act as a LexicalHandler and DeclHandler but will silently ignore any SAXNotRecognizedException or SAXNotSupportedException thrown by the parent XMLReader when setting these properties. In this case it will act as if it were a standard XMLFilterImpl. When an XMLFilter produced by Saxon (and possibly by other XSLT processors) is followed by one extended from this class in a filter chain (PipelinedComparator input filters or JAXP) this is likely to be the case.
Constructor and Description |
---|
XMLFilterImpl2()
Creates a new XMLFilterImpl2.
|
Modifier and Type | Method and Description |
---|---|
void |
attributeDecl(java.lang.String eName,
java.lang.String aName,
java.lang.String type,
java.lang.String valueDefault,
java.lang.String value)
An extensible implementation of the Declaration Handler attributeDecl event, which reports DTD related (external DTD or
internal subset) attribute declarations.
|
void |
comment(char[] ch,
int start,
int length)
An extensible implementation of the SAX LexicalHandler comment event, which reports any comments identified by the parser.
|
void |
elementDecl(java.lang.String name,
java.lang.String model)
An extensible implementation of the Declaration Handler elementDecl event, which reports DTD related (external DTD or
internal subset) element declarations.
|
void |
endCDATA()
An extensible implementation of the SAX LexicalHandler endCDATA event, which reports the end of a CDATA boundry idenitified
by the parser.
|
void |
endDTD()
An extensible implementation of the SAX LexicalHandler endDTD event, which reports the end of DOCTYPE processing by the
parser.
|
void |
endEntity(java.lang.String name)
An extensible implementation of the SAX LexicalHandler endEntity event, which reports the end of entity instance processing
by the parser.
|
void |
externalEntityDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
An extensible implementation of the Declaration Handler externalEntityDecl event, which reports DTD related (external DTD or
internal subset) external entity declarations.
|
java.lang.Object |
getProperty(java.lang.String name)
Reports a current property setting.
|
void |
internalEntityDecl(java.lang.String name,
java.lang.String value)
An extensible implementation of the Declaration Handler intenalEntityDecl event, which reports DTD related (external DTD or
internal subset) internal entity declarations.
|
void |
parse(org.xml.sax.InputSource source)
An implementation of the
XMLReader.parse(InputSource) method. |
void |
parse(java.lang.String systemId)
An implementation of the
XMLReader.parse(String) method. |
void |
setProperty(java.lang.String name,
java.lang.Object value)
Specifies a property used to configure the filter.
|
void |
startCDATA()
An extensible implementation of the SAX LexicalHandler startCDATA event, which reports the start of a CDATA boundry
idenitified by the parser.
|
void |
startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
An extensible implementation of the SAX LexicalHandler startDTD event, which reports the start of DOCTYPE processing by the
parser.
|
void |
startEntity(java.lang.String name)
An extensible implementation of the SAX LexicalHandler startEntity event, which reports the start of entity instance
processing by the parser.
|
characters, endDocument, endElement, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning
public void parse(org.xml.sax.InputSource source) throws org.xml.sax.SAXException, java.io.IOException, java.lang.UnsupportedOperationException
An implementation of the XMLReader.parse(InputSource)
method. This method when called can trigger a JAXP
SAX-event passing pipeline. Alternatively it may be called indirectly (behind the
scenes) by triggering another pipeline stage and then via the setParent
method the triggered stage will
call this parse method.
The behaviour of this method differs from that of the supertype XMLFilterImpl.parse(InputSource)
method in that it
does not 'chain' the entityResolver from the parent. This allows an XMLReader at the start of a SAX filter pipeline to set
and control its own entityResolver without interference from downstream filters. The behaviour of this class is also
consistent with the behaviour of XMLFilters produced from Saxon B 9.1
parse
in interface org.xml.sax.XMLReader
parse
in class org.xml.sax.helpers.XMLFilterImpl
source
- the data to be processed (by this stage, or initially by an upstream pipeline stage and passed to this stage as
SAX events)org.xml.sax.SAXException
- if the supertype throws this exceptionjava.io.IOException
- if the supertype throws this exceptionjava.lang.UnsupportedOperationException
- if this method is called before configuring the pipeline with the setParent methodXMLFilterImpl.setParent(XMLReader)
,
XMLFilterImpl.parse(InputSource)
,
XMLReader.parse(InputSource)
public void parse(java.lang.String systemId) throws org.xml.sax.SAXException, java.io.IOException, java.lang.UnsupportedOperationException
XMLReader.parse(String)
method. This method when called can trigger a JAXP SAX-event
passing pipeline. Alternatively it may be called indirectly (behind the
scenes) by triggering another pipeline stage and then via the setParent
method the triggered stage will
call this parse method.parse
in interface org.xml.sax.XMLReader
parse
in class org.xml.sax.helpers.XMLFilterImpl
systemId
- A URL which specifies the data to be processed (by this stage, or an upstream pipeline stage)org.xml.sax.SAXException
- if the supertype throws this exceptionjava.io.IOException
- if the supertype throws this exceptionjava.lang.UnsupportedOperationException
- if this method is called before configuring the pipeline with the setParent methodXMLFilterImpl.setParent(XMLReader)
,
XMLFilterImpl.parse(String)
,
XMLReader.parse(String)
public void setProperty(java.lang.String name, java.lang.Object value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
setProperty
in interface org.xml.sax.XMLReader
setProperty
in class org.xml.sax.helpers.XMLFilterImpl
name
- the name of the property to be assignedvalue
- the new value of the propertyorg.xml.sax.SAXNotRecognizedException
- if the feature name is not recognizedorg.xml.sax.SAXNotSupportedException
- if it is not possible to configure the feature with the specified valueXMLFilterImpl.setProperty(String, Object)
,
XMLReader.setProperty(String, Object)
,
SAX Property
documentationpublic java.lang.Object getProperty(java.lang.String name) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
getProperty
in interface org.xml.sax.XMLReader
getProperty
in class org.xml.sax.helpers.XMLFilterImpl
name
- the name of the property to be reportedorg.xml.sax.SAXNotRecognizedException
- if the feature name is not recognizedorg.xml.sax.SAXNotSupportedException
- if it is not possible to determine the feature's valueXMLFilterImpl.getProperty(String)
,
XMLReader.getProperty(String)
,
SAX Property
documentationpublic 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 name reportedmodel
- The declaration contentorg.xml.sax.SAXException
- if the supertype throws this exceptionDeclHandler.elementDecl(String, String)
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
attributeDecl
in interface org.xml.sax.ext.DeclHandler
eName
- The name of the element containing the attributeaName
- The name of the attributetype
- The type of the attributevalueDefault
- The default value of the attribute, unless specified otherwisevalue
- ????org.xml.sax.SAXException
- if the supertype throws this exceptionDeclHandler.attributeDecl(String, String, String, String, 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 entityvalue
- The entity valueorg.xml.sax.SAXException
- if the supertype throws this exceptionDeclHandler.internalEntityDecl(String, 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 entitypublicId
- A publicId which identifies the external entitysystemId
- A systemId which locates the external entityorg.xml.sax.SAXException
- if the supertype throws this exceptionDeclHandler.externalEntityDecl(String, String, String)
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 name of the root elementpublicId
- The publicId of an external DTDsystemId
- The systemId used to locate the external DTDorg.xml.sax.SAXException
- if the supertype throws this exceptionLexicalHandler.startDTD(String, String, String)
public void endDTD() throws org.xml.sax.SAXException
endDTD
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
- if the supertype throws this exceptionLexicalHandler.startDTD(String, String, String)
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 entityorg.xml.sax.SAXException
- if the supertype throws this exceptionLexicalHandler.startEntity(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 entityorg.xml.sax.SAXException
- if the supertype throws this exceptionLexicalHandler.endEntity(String)
public void startCDATA() throws org.xml.sax.SAXException
startCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
- if the supertype throws this exceptionLexicalHandler.startCDATA()
,
ContentHandler.characters(char[], int, int)
public void endCDATA() throws org.xml.sax.SAXException
endCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
- if the supertype throws this exceptionLexicalHandler.endCDATA()
,
ContentHandler.characters(char[], int, int)
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 comment amongst other character datastart
- the starting position of this comment with the arraylength
- the number of characters to use from the arrayorg.xml.sax.SAXException
- if the supertype throws this exceptionLexicalHandler.comment(char[], int, int)