|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.xml.sax.helpers.XMLFilterImpl | +--com.simonstl.gorille.CharRulesFilter
A SAX filter which tests information against the XML character rules. This code has not been well-tested, as SAX parsers perform such testing in advance of the information reaching this filter. This filter is intended as a demonstration of how such layering might work if parsers outsourced that work, and also as a tool for checking SAX events generated internally by programs before passing them to other processors.
Field Summary | |
static int |
ERROR
|
protected int |
errorHandling
|
static int |
FATAL_ERROR
|
protected org.xml.sax.Locator |
locator
|
protected CharRules |
rules
|
protected boolean |
verbose
|
static int |
WARNING
|
Constructor Summary | |
CharRulesFilter()
An empty constructor that requires the use of setParent before starting I don't think this works. |
|
CharRulesFilter(org.xml.sax.XMLReader parent)
A constructor that takes the parser which will feed it SAX events |
Method Summary | |
void |
characters(char[] ch,
int start,
int length)
Filter a character data event. |
void |
endDocument()
Filter an end document event. |
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
Filter an end element event. |
void |
endPrefixMapping(java.lang.String prefix)
Filter an end Namespace prefix mapping event. |
boolean |
getFeature(java.lang.String name)
Look up the value of a feature. |
java.lang.Object |
getProperty(java.lang.String name)
Look up the value of a property. |
CharRules |
getRules()
in case you ever need to get the rules out of the tester |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Filter an ignorable whitespace event. |
void |
notationDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Filter a notation declaration event. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Filter a processing instruction event. |
protected void |
reportError(org.xml.sax.SAXParseException e)
|
void |
setDocumentLocator(org.xml.sax.Locator _locator)
Filter a new document locator event. |
void |
setErrorType(int _errorHandling)
sets up error-handling. |
void |
setFeature(java.lang.String name,
boolean value)
Set the value of a feature. |
void |
setProperty(java.lang.String name,
java.lang.Object value)
Set the value of a property. |
void |
setRules(CharRules newRules)
sets up the rules, read in from a config file by CharRulesLoader or
otherwise concocted in Java using the CharRules class. |
void |
setVerbose(boolean _verbose)
Sets whether the filter should report errors to the command-line. |
void |
skippedEntity(java.lang.String name)
Filter a skipped entity event. |
void |
startDocument()
Filter a start document event. |
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
Filter a start element event. |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
Filter a start Namespace prefix mapping event. |
void |
unparsedEntityDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId,
java.lang.String notationName)
Filter an unparsed entity declaration event. |
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl |
error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getParent, parse, parse, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setParent, warning |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int FATAL_ERROR
public static final int ERROR
public static final int WARNING
protected CharRules rules
protected int errorHandling
protected org.xml.sax.Locator locator
protected boolean verbose
Constructor Detail |
public CharRulesFilter()
public CharRulesFilter(org.xml.sax.XMLReader parent)
Method Detail |
public void setFeature(java.lang.String name, boolean value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
setFeature
in class org.xml.sax.helpers.XMLFilterImpl
name
- The feature name.value
- The requested feature value.org.xml.sax.SAXNotRecognizedException
- If the feature
value can't be assigned or retrieved from the parent.org.xml.sax.SAXNotSupportedException
- When the
parent recognizes the feature name but
cannot set the requested value.XMLReader.setFeature(java.lang.String, boolean)
public boolean getFeature(java.lang.String name) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
getFeature
in class org.xml.sax.helpers.XMLFilterImpl
name
- The feature name.org.xml.sax.SAXNotRecognizedException
- If the feature
value can't be assigned or retrieved from the parent.org.xml.sax.SAXNotSupportedException
- When the
parent recognizes the feature name but
cannot determine its value at this time.XMLReader.getFeature(java.lang.String)
public void setProperty(java.lang.String name, java.lang.Object value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
setProperty
in class org.xml.sax.helpers.XMLFilterImpl
name
- The property name.value
- The requested property value.org.xml.sax.SAXNotRecognizedException
- If the property
value can't be assigned or retrieved from the parent.org.xml.sax.SAXNotSupportedException
- When the
parent recognizes the property name but
cannot set the requested value.XMLReader.setProperty(java.lang.String, java.lang.Object)
public java.lang.Object getProperty(java.lang.String name) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
getProperty
in class org.xml.sax.helpers.XMLFilterImpl
name
- The property name.org.xml.sax.SAXNotRecognizedException
- If the property
value can't be assigned or retrieved from the parent.org.xml.sax.SAXNotSupportedException
- When the
parent recognizes the property name but
cannot determine its value at this time.XMLReader.setFeature(java.lang.String, boolean)
public void setRules(CharRules newRules)
CharRulesLoader
or
otherwise concocted in Java using the CharRules
class.newRules
- the set of rules the class will apply to contentpublic void setVerbose(boolean _verbose)
public void setErrorType(int _errorHandling)
_ErrorHandling
- the set of rules the class will apply to contentpublic CharRules getRules()
protected void reportError(org.xml.sax.SAXParseException e)
public void setDocumentLocator(org.xml.sax.Locator _locator)
setDocumentLocator
in class org.xml.sax.helpers.XMLFilterImpl
locator
- The document locator.public void notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
notationDecl
in class org.xml.sax.helpers.XMLFilterImpl
name
- The notation name.publicId
- The notation's public identifier, or null.systemId
- The notation's system identifier, or null.org.xml.sax.SAXException
- The client may throw
an exception during processing.public void unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName) throws org.xml.sax.SAXException
unparsedEntityDecl
in class org.xml.sax.helpers.XMLFilterImpl
name
- The entity name.publicId
- The entity's public identifier, or null.systemId
- The entity's system identifier, or null.notationName
- The name of the associated notation.org.xml.sax.SAXException
- The client may throw
an exception during processing.public void startDocument() throws org.xml.sax.SAXException
startDocument
in class org.xml.sax.helpers.XMLFilterImpl
org.xml.sax.SAXException
- The client may throw
an exception during processing.public void endDocument() throws org.xml.sax.SAXException
endDocument
in class org.xml.sax.helpers.XMLFilterImpl
org.xml.sax.SAXException
- The client may throw
an exception during processing.public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException
startPrefixMapping
in class org.xml.sax.helpers.XMLFilterImpl
prefix
- The Namespace prefix.uri
- The Namespace URI.org.xml.sax.SAXException
- The client may throw
an exception during processing.public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException
endPrefixMapping
in class org.xml.sax.helpers.XMLFilterImpl
prefix
- The Namespace prefix.org.xml.sax.SAXException
- The client may throw
an exception during processing.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
startElement
in class org.xml.sax.helpers.XMLFilterImpl
uri
- The element's Namespace URI, or the empty string.localName
- The element's local name, or the empty string.qName
- The element's qualified (prefixed) name, or the empty
string.atts
- The element's attributes.org.xml.sax.SAXException
- The client may throw
an exception during processing.public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in class org.xml.sax.helpers.XMLFilterImpl
uri
- The element's Namespace URI, or the empty string.localName
- The element's local name, or the empty string.qName
- The element's qualified (prefixed) name, or the empty
string.org.xml.sax.SAXException
- The client may throw
an exception during processing.public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
characters
in class org.xml.sax.helpers.XMLFilterImpl
ch
- An array of characters.start
- The starting position in the array.length
- The number of characters to use from the array.org.xml.sax.SAXException
- The client may throw
an exception during processing.public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
ignorableWhitespace
in class org.xml.sax.helpers.XMLFilterImpl
ch
- An array of characters.start
- The starting position in the array.length
- The number of characters to use from the array.org.xml.sax.SAXException
- The client may throw
an exception during processing.public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
processingInstruction
in class org.xml.sax.helpers.XMLFilterImpl
target
- The processing instruction target.data
- The text following the target.org.xml.sax.SAXException
- The client may throw
an exception during processing.public void skippedEntity(java.lang.String name) throws org.xml.sax.SAXException
skippedEntity
in class org.xml.sax.helpers.XMLFilterImpl
name
- The name of the skipped entity.org.xml.sax.SAXException
- The client may throw
an exception during processing.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |