public class HookableSaxHandler extends DefaultHandler
Modifier and Type | Class and Description |
---|---|
static class |
HookableSaxHandler.ContentCapturingHandler
A SAX parser hook handler that captures the element's character content for
processing in the endElement() method.
|
static class |
HookableSaxHandler.ElementHandler
Represents a handler for when a SAX path condition matches
|
static class |
HookableSaxHandler.SaxPathExpressionChecker
Describes a path in an XML document that can be evaluated while doing SAX
parsing, and keeps track of the current matching state(s).
|
Modifier and Type | Field and Description |
---|---|
protected Locator |
locator
To keep track of the position within the document
|
Constructor and Description |
---|
HookableSaxHandler() |
Modifier and Type | Method and Description |
---|---|
void |
addHook(String condition,
HookableSaxHandler.ElementHandler handler)
Add a hook to the parser.
|
void |
addHook(String condition,
HookableSaxHandler.ElementHandler handler,
boolean callHandlerForAllDescendants)
Add a hook to the parser.
|
void |
characters(char[] ch,
int start,
int length)
Called when character content (not a tag) is encountered in the XML.
|
String |
describePosition()
Describe current parsing position
|
void |
endElement(String uri,
String localName,
String qName)
Called when an end tag (element close tag) is encountered in the XML.
|
void |
setDocumentLocator(Locator locator) |
void |
startElement(String uri,
String localName,
String qName,
Attributes attributes)
Called when an start tag (element open tag) is encountered in the XML.
|
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
protected Locator locator
public void addHook(String condition, HookableSaxHandler.ElementHandler handler, boolean callHandlerForAllDescendants)
condition
- when to invoke the handler (xpath subset expression)handler
- what to do when the condition matchescallHandlerForAllDescendants
- whether or not to call the handler for
all descendants of the matched elementpublic void addHook(String condition, HookableSaxHandler.ElementHandler handler)
condition
- when to invoke the handler (xpath subset expression)handler
- what to do when the condition matchespublic void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
setDocumentLocator
in class DefaultHandler
public String describePosition()
public void characters(char[] ch, int start, int length)
characters
in interface ContentHandler
characters
in class DefaultHandler
public void endElement(String uri, String localName, String qName)
endElement
in interface ContentHandler
endElement
in class DefaultHandler
public void startElement(String uri, String localName, String qName, Attributes attributes)
startElement
in interface ContentHandler
startElement
in class DefaultHandler
Copyright © 2020 Instituut voor Nederlandse Taal (INT). All rights reserved.