gnu.xml.pipeline

Class WellFormednessFilter

Implemented Interfaces:
ContentHandler, ContentHandler2, DeclHandler, DTDHandler, EventConsumer, LexicalHandler

public final class WellFormednessFilter
extends EventFilter

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.

Field Summary

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(ch[] , int start, int length)
void
comment(ch[] , int start, int length)
void
endCDATA()
void
endDTD()
void
endDocument()
void
endElement(String uri, String localName, String qName)
void
ignorableWhitespace(ch[] , int start, int length)
void
notationDecl(String name, String publicId, String systemId)
void
processingInstruction(String target, String data)
void
reset()
Resets state as if any preceding event stream was well formed.
void
setDocumentLocator(Locator locator)
Throws an exception when called after startDocument.
void
startCDATA()
void
startDTD(String root, String publicId, String systemId)
void
startDocument()
void
startElement(String uri, String localName, String qName, Attributes atts)
void
unparsedEntityDecl(String name, String publicId, String systemId, String notationName)

Methods inherited from class gnu.xml.pipeline.EventFilter

attributeDecl, bind, chainTo, characters, comment, elementDecl, endCDATA, endDTD, endDocument, endElement, endEntity, endPrefixMapping, externalEntityDecl, getContentHandler, getDTDHandler, getDocumentLocator, getErrorHandler, getNext, getProperty, ignorableWhitespace, internalEntityDecl, notationDecl, processingInstruction, setContentHandler, setDTDHandler, setDocumentLocator, setErrorHandler, setProperty, skippedEntity, startCDATA, startDTD, startDocument, startElement, startEntity, startPrefixMapping, unparsedEntityDecl, xmlDecl

Constructor Details

WellFormednessFilter

public WellFormednessFilter()
Swallows all events after performing well formedness checks.

WellFormednessFilter

public WellFormednessFilter(EventConsumer consumer)
Passes events through to the specified consumer, after first processing them.

Method Details

characters

public void characters(ch[] ,
                       int start,
                       int length)
            throws SAXException
Specified by:
characters in interface ContentHandler
Overrides:
characters in interface EventFilter

comment

public void comment(ch[] ,
                    int start,
                    int length)
            throws SAXException
Specified by:
comment in interface LexicalHandler
Overrides:
comment in interface EventFilter

endCDATA

public void endCDATA()
            throws SAXException
Specified by:
endCDATA in interface LexicalHandler
Overrides:
endCDATA in interface EventFilter

endDTD

public void endDTD()
            throws SAXException
Specified by:
endDTD in interface LexicalHandler
Overrides:
endDTD in interface EventFilter

endDocument

public void endDocument()
            throws SAXException
Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in interface EventFilter

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
            throws SAXException
Specified by:
endElement in interface ContentHandler
Overrides:
endElement in interface EventFilter

ignorableWhitespace

public void ignorableWhitespace(ch[] ,
                                int start,
                                int length)
            throws SAXException
Specified by:
ignorableWhitespace in interface ContentHandler
Overrides:
ignorableWhitespace in interface EventFilter

notationDecl

public void notationDecl(String name,
                         String publicId,
                         String systemId)
            throws SAXException
Specified by:
notationDecl in interface DTDHandler
Overrides:
notationDecl in interface EventFilter

processingInstruction

public void processingInstruction(String target,
                                  String data)
            throws SAXException
Specified by:
processingInstruction in interface ContentHandler
Overrides:
processingInstruction in interface EventFilter

reset

public void reset()
Resets state as if any preceding event stream was well formed. Particularly useful if it ended through some sort of error, and the endDocument call wasn't made.

setDocumentLocator

public void setDocumentLocator(Locator locator)
Throws an exception when called after startDocument.
Specified by:
setDocumentLocator in interface ContentHandler
Overrides:
setDocumentLocator in interface EventFilter
Parameters:
locator - the locator, to be used in error reporting or relative URI resolution.

startCDATA

public void startCDATA()
            throws SAXException
Specified by:
startCDATA in interface LexicalHandler
Overrides:
startCDATA in interface EventFilter

startDTD

public void startDTD(String root,
                     String publicId,
                     String systemId)
            throws SAXException
Specified by:
startDTD in interface LexicalHandler
Overrides:
startDTD in interface EventFilter

startDocument

public void startDocument()
            throws SAXException
Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in interface EventFilter

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes atts)
            throws SAXException
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in interface EventFilter

unparsedEntityDecl

public void unparsedEntityDecl(String name,
                               String publicId,
                               String systemId,
                               String notationName)
            throws SAXException
Specified by:
unparsedEntityDecl in interface DTDHandler
Overrides:
unparsedEntityDecl in interface EventFilter