Class SPathFilter
- java.lang.Object
-
- org.xml.sax.helpers.XMLFilterImpl
-
- org.apache.taglibs.standard.extra.spath.SPathFilter
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
,org.xml.sax.XMLFilter
,org.xml.sax.XMLReader
public class SPathFilter extends org.xml.sax.helpers.XMLFilterImpl
Filters a SAX stream based on a single supplied SPath expression.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Stack
acceptedDepths
private static boolean
DEBUG
private int
depth
private int
excludedDepth
protected java.util.List
steps
The steps in the SPath expression we use for filtering.
-
Constructor Summary
Constructors Constructor Description SPathFilter(Path path)
Constructs a new SPathFilter, given a Path.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
characters(char[] ch, int start, int length)
Filter for characters().void
endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
Filter for endElement().void
endPrefixMapping(java.lang.String prefix)
Filter for endPrefixMapping().void
ignorableWhitespace(char[] ch, int start, int length)
Filter for ignoreableWhitespace().private void
init()
Initializes state used for filtering.private boolean
isAccepted()
Returns true if events should be passed through, false otherwise.private boolean
isExcluded()
Returns true if events should be blocked, false otherwise.static boolean
nodeMatchesStep(Step s, java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes a)
void
processingInstruction(java.lang.String target, java.lang.String data)
Filter for processingInstruction().void
skippedEntity(java.lang.String name)
Filter for skippedEntity().void
startDocument()
Resets state.void
startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes a)
Filter for startElement().void
startPrefixMapping(java.lang.String prefix, java.lang.String uri)
Filter for startPrefixMapping().-
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
endDocument, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, notationDecl, parse, parse, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, unparsedEntityDecl, warning
-
-
-
-
Field Detail
-
steps
protected java.util.List steps
The steps in the SPath expression we use for filtering.
-
depth
private int depth
-
acceptedDepths
private java.util.Stack acceptedDepths
-
excludedDepth
private int excludedDepth
-
DEBUG
private static final boolean DEBUG
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SPathFilter
public SPathFilter(Path path)
Constructs a new SPathFilter, given a Path.
-
-
Method Detail
-
init
private void init()
Initializes state used for filtering.
-
startElement
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes a) throws org.xml.sax.SAXException
Filter for startElement().- Specified by:
startElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startElement
in classorg.xml.sax.helpers.XMLFilterImpl
- Throws:
org.xml.sax.SAXException
-
endElement
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
Filter for endElement().- Specified by:
endElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endElement
in classorg.xml.sax.helpers.XMLFilterImpl
- Throws:
org.xml.sax.SAXException
-
ignorableWhitespace
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
Filter for ignoreableWhitespace().- Specified by:
ignorableWhitespace
in interfaceorg.xml.sax.ContentHandler
- Overrides:
ignorableWhitespace
in classorg.xml.sax.helpers.XMLFilterImpl
- Throws:
org.xml.sax.SAXException
-
characters
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
Filter for characters().- Specified by:
characters
in interfaceorg.xml.sax.ContentHandler
- Overrides:
characters
in classorg.xml.sax.helpers.XMLFilterImpl
- Throws:
org.xml.sax.SAXException
-
startPrefixMapping
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException
Filter for startPrefixMapping().- Specified by:
startPrefixMapping
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startPrefixMapping
in classorg.xml.sax.helpers.XMLFilterImpl
- Throws:
org.xml.sax.SAXException
-
endPrefixMapping
public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException
Filter for endPrefixMapping().- Specified by:
endPrefixMapping
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endPrefixMapping
in classorg.xml.sax.helpers.XMLFilterImpl
- Throws:
org.xml.sax.SAXException
-
processingInstruction
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
Filter for processingInstruction().- Specified by:
processingInstruction
in interfaceorg.xml.sax.ContentHandler
- Overrides:
processingInstruction
in classorg.xml.sax.helpers.XMLFilterImpl
- Throws:
org.xml.sax.SAXException
-
skippedEntity
public void skippedEntity(java.lang.String name) throws org.xml.sax.SAXException
Filter for skippedEntity().- Specified by:
skippedEntity
in interfaceorg.xml.sax.ContentHandler
- Overrides:
skippedEntity
in classorg.xml.sax.helpers.XMLFilterImpl
- Throws:
org.xml.sax.SAXException
-
startDocument
public void startDocument()
Resets state.- Specified by:
startDocument
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startDocument
in classorg.xml.sax.helpers.XMLFilterImpl
-
nodeMatchesStep
public static boolean nodeMatchesStep(Step s, java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes a)
-
isAccepted
private boolean isAccepted()
Returns true if events should be passed through, false otherwise.
-
isExcluded
private boolean isExcluded()
Returns true if events should be blocked, false otherwise.
-
-