public class SPathFilter
extends org.xml.sax.helpers.XMLFilterImpl
Filters a SAX stream based on a single supplied SPath expression.
| Modifier and Type | Field and 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 and Description |
|---|
SPathFilter(Path path)
Constructs a new SPathFilter, given a Path.
|
| Modifier and Type | Method and 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().
|
endDocument, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, notationDecl, parse, parse, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, unparsedEntityDecl, warningprotected java.util.List steps
private int depth
private java.util.Stack acceptedDepths
private int excludedDepth
private static final boolean DEBUG
public SPathFilter(Path path)
private void init()
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
startElement in interface org.xml.sax.ContentHandlerstartElement in class org.xml.sax.helpers.XMLFilterImplorg.xml.sax.SAXExceptionpublic void endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
throws org.xml.sax.SAXException
endElement in interface org.xml.sax.ContentHandlerendElement in class org.xml.sax.helpers.XMLFilterImplorg.xml.sax.SAXExceptionpublic void ignorableWhitespace(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
ignorableWhitespace in interface org.xml.sax.ContentHandlerignorableWhitespace in class org.xml.sax.helpers.XMLFilterImplorg.xml.sax.SAXExceptionpublic void characters(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
characters in interface org.xml.sax.ContentHandlercharacters in class org.xml.sax.helpers.XMLFilterImplorg.xml.sax.SAXExceptionpublic void startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
throws org.xml.sax.SAXException
startPrefixMapping in interface org.xml.sax.ContentHandlerstartPrefixMapping in class org.xml.sax.helpers.XMLFilterImplorg.xml.sax.SAXExceptionpublic void endPrefixMapping(java.lang.String prefix)
throws org.xml.sax.SAXException
endPrefixMapping in interface org.xml.sax.ContentHandlerendPrefixMapping in class org.xml.sax.helpers.XMLFilterImplorg.xml.sax.SAXExceptionpublic void processingInstruction(java.lang.String target,
java.lang.String data)
throws org.xml.sax.SAXException
processingInstruction in interface org.xml.sax.ContentHandlerprocessingInstruction in class org.xml.sax.helpers.XMLFilterImplorg.xml.sax.SAXExceptionpublic void skippedEntity(java.lang.String name)
throws org.xml.sax.SAXException
skippedEntity in interface org.xml.sax.ContentHandlerskippedEntity in class org.xml.sax.helpers.XMLFilterImplorg.xml.sax.SAXExceptionpublic void startDocument()
startDocument in interface org.xml.sax.ContentHandlerstartDocument in class org.xml.sax.helpers.XMLFilterImplpublic static boolean nodeMatchesStep(Step s, java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes a)
private boolean isAccepted()
private boolean isExcluded()