|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gnu.xml.pipeline.EventFilter | +--gnu.xml.pipeline.WellFormednessFilter
This filter reports fatal exceptions in the case of event streams that are not well formed. The rules currently tested include:
Other checks for event stream correctness may be provided in the future. For example, insisting that entity boundaries nest correctly, namespace scopes nest correctly, namespace values never contain relative URIs, attributes don't have "<" characters; and more.
Fields inherited from class gnu.xml.pipeline.EventFilter |
DECL_HANDLER, FEATURE_URI, LEXICAL_HANDLER, PROPERTY_URI |
Constructor Summary | |
WellFormednessFilter()
Swallows all events after performing well formedness checks. |
|
WellFormednessFilter(EventConsumer consumer)
Passes events through to the specified consumer, after first processing them. |
Method Summary | |
void |
characters(char[] buf,
int off,
int len)
SAX2: passes this callback to the next consumer, if any |
void |
comment(char[] buf,
int off,
int len)
SAX2: passes this callback to the next consumer, if any |
void |
endCDATA()
SAX2: passes this callback to the next consumer, if any |
void |
endDocument()
SAX2: passes this callback to the next consumer, if any |
void |
endDTD()
SAX2: passes this callback to the next consumer, if any |
void |
endElement(java.lang.String ns,
java.lang.String l,
java.lang.String name)
SAX2: passes this callback to the next consumer, if any |
void |
ignorableWhitespace(char[] buf,
int off,
int len)
SAX2: passes this callback to the next consumer, if any |
void |
notationDecl(java.lang.String name,
java.lang.String pub,
java.lang.String sys)
SAX1: passes this callback to the next consumer, if any |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
SAX2: passes this callback to the next consumer, if any |
void |
reset()
Resets state as if any preceding event stream was well formed. |
void |
setDocumentLocator(Locator l)
Throws an exception when called after startDocument. |
void |
startCDATA()
SAX2: passes this callback to the next consumer, if any |
void |
startDocument()
SAX2: passes this callback to the next consumer, if any |
void |
startDTD(java.lang.String root,
java.lang.String p,
java.lang.String s)
SAX2: passes this callback to the next consumer, if any |
void |
startElement(java.lang.String ns,
java.lang.String l,
java.lang.String name,
Attributes atts)
SAX2: passes this callback to the next consumer, if any |
void |
unparsedEntityDecl(java.lang.String name,
java.lang.String p,
java.lang.String s,
java.lang.String n)
SAX1: passes this callback to the next consumer, if any |
Methods inherited from class gnu.xml.pipeline.EventFilter |
attributeDecl, bind, elementDecl, endEntity, endPrefixMapping, externalEntityDecl, getContentHandler, getDocumentLocator, getDTDHandler, getErrorHandler, getNext, getProperty, internalEntityDecl, setContentHandler, setDTDHandler, setErrorHandler, setProperty, skippedEntity, startEntity, startPrefixMapping |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public WellFormednessFilter()
public WellFormednessFilter(EventConsumer consumer)
Method Detail |
public void reset()
public void setDocumentLocator(Locator l)
setDocumentLocator
in class EventFilter
l
- the locator, to be used in error reporting or relative
URI resolution.IllegalStateException
- when called after the document
has already been startedpublic void startDocument() throws SAXException
EventFilter
startDocument
in class EventFilter
org.xml.sax.ContentHandler
SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.endDocument()
public void startElement(java.lang.String ns, java.lang.String l, java.lang.String name, Attributes atts) throws SAXException
EventFilter
startElement
in class EventFilter
org.xml.sax.ContentHandler
uri
- The Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performed.localName
- The local name (without prefix), or the
empty string if Namespace processing is not being
performed.qName
- The qualified name (with prefix), or the
empty string if qualified names are not available.atts
- The attributes attached to the element. If
there are no attributes, it shall be an empty
Attributes object.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
,
Attributes
public void endElement(java.lang.String ns, java.lang.String l, java.lang.String name) throws SAXException
EventFilter
endElement
in class EventFilter
org.xml.sax.ContentHandler
uri
- The Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performed.localName
- The local name (without prefix), or the
empty string if Namespace processing is not being
performed.qName
- The qualified XML 1.0 name (with prefix), or the
empty string if qualified names are not available.SAXException
- Any SAX exception, possibly
wrapping another exception.public void endDocument() throws SAXException
EventFilter
endDocument
in class EventFilter
org.xml.sax.ContentHandler
SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.startDocument()
public void startDTD(java.lang.String root, java.lang.String p, java.lang.String s) throws SAXException
EventFilter
startDTD
in class EventFilter
org.xml.sax.ext.LexicalHandler
name
- The document type name.publicId
- The declared public identifier for the
external DTD subset, or null if none was declared.systemId
- The declared system identifier for the
external DTD subset, or null if none was declared.SAXException
- The application may raise an
exception.LexicalHandler.endDTD()
,
LexicalHandler.startEntity(java.lang.String)
public void notationDecl(java.lang.String name, java.lang.String pub, java.lang.String sys) throws SAXException
EventFilter
notationDecl
in class EventFilter
org.xml.sax.DTDHandler
name
- The notation name.publicId
- The notation's public identifier, or null if
none was given.systemId
- The notation's system identifier, or null if
none was given.SAXException
- Any SAX exception, possibly
wrapping another exception.DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
,
AttributeList
public void unparsedEntityDecl(java.lang.String name, java.lang.String p, java.lang.String s, java.lang.String n) throws SAXException
EventFilter
unparsedEntityDecl
in class EventFilter
org.xml.sax.DTDHandler
name
- The unparsed entity's name.publicId
- The entity's public identifier, or null if none
was given.systemId
- The entity's system identifier.notation
- name The name of the associated notation.SAXException
- Any SAX exception, possibly
wrapping another exception.DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)
,
AttributeList
public void endDTD() throws SAXException
EventFilter
endDTD
in class EventFilter
org.xml.sax.ext.LexicalHandler
SAXException
- The application may raise an exception.LexicalHandler.startDTD(java.lang.String, java.lang.String, java.lang.String)
public void characters(char[] buf, int off, int len) throws SAXException
EventFilter
characters
in class EventFilter
org.xml.sax.ContentHandler
ch
- The characters from the XML document.start
- The start position in the array.length
- The number of characters to read from the array.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.ignorableWhitespace(char[], int, int)
,
Locator
public void ignorableWhitespace(char[] buf, int off, int len) throws SAXException
EventFilter
ignorableWhitespace
in class EventFilter
org.xml.sax.ContentHandler
ch
- The characters from the XML document.start
- The start position in the array.length
- The number of characters to read from the array.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.characters(char[], int, int)
public void processingInstruction(java.lang.String target, java.lang.String data) throws SAXException
EventFilter
processingInstruction
in class EventFilter
org.xml.sax.ContentHandler
target
- The processing instruction target.data
- The processing instruction data, or null if
none was supplied. The data does not include any
whitespace separating it from the target.SAXException
- Any SAX exception, possibly
wrapping another exception.public void comment(char[] buf, int off, int len) throws SAXException
EventFilter
comment
in class EventFilter
org.xml.sax.ext.LexicalHandler
ch
- An array holding the characters in the comment.start
- The starting position in the array.length
- The number of characters to use from the array.SAXException
- The application may raise an exception.public void startCDATA() throws SAXException
EventFilter
startCDATA
in class EventFilter
org.xml.sax.ext.LexicalHandler
SAXException
- The application may raise an exception.LexicalHandler.endCDATA()
public void endCDATA() throws SAXException
EventFilter
endCDATA
in class EventFilter
org.xml.sax.ext.LexicalHandler
SAXException
- The application may raise an exception.LexicalHandler.startCDATA()
|
Source code is GPL'd in the JAXP subproject at http://savannah.gnu.org/projects/classpathx |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |