org.brownell.xml.pipeline
Class WellFormednessFilter

java.lang.Object
  |
  +--org.brownell.xml.pipeline.EventFilter
        |
        +--org.brownell.xml.pipeline.WellFormednessFilter

public final class WellFormednessFilter
extends EventFilter

This filter reports fatal exceptions in the case of event streams that are not well formed. The following rules are currently tested:

Other checks for event stream correctness may be provided in the future.

Version:
$Date: 2000/02/15 21:28:31 $
Author:
David Brownell

Fields inherited from class org.brownell.xml.pipeline.EventFilter
HANDLER_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 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 reset()
          Resets state as if any preceding event stream was well formed.
 void setDocumentLocator(Locator l)
          Throws a RuntimeException 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
 
Methods inherited from class org.brownell.xml.pipeline.EventFilter
attributeDecl, characters, comment, elementDecl, endEntity, endPrefixMapping, externalEntityDecl, getContentHandler, getDTDHandler, getErrorHandler, getNext, getProperty, ignorableWhitespace, internalEntityDecl, notationDecl, processingInstruction, setContentHandler, setDTDHandler, setErrorHandler, setProperty, skippedEntity, startEntity, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

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 l)
Throws a RuntimeException when called after startDocument. The SAX APIs do not permit a SAXException to be reported from this method.
Overrides:
setDocumentLocator in class EventFilter
Parameters:
l - the locator, to be used in error reporting or relative URI resolution.

startDocument

public void startDocument()
                   throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any
Overrides:
startDocument in class EventFilter
Tags copied from interface: ContentHandler
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.endDocument()

startElement

public void startElement(java.lang.String ns,
                         java.lang.String l,
                         java.lang.String name,
                         Attributes atts)
                  throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any
Overrides:
startElement in class EventFilter
Tags copied from interface: ContentHandler
Parameters:
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.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String), Attributes

endElement

public void endElement(java.lang.String ns,
                       java.lang.String l,
                       java.lang.String name)
                throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any
Overrides:
endElement in class EventFilter
Tags copied from interface: ContentHandler
Parameters:
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.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.

endDocument

public void endDocument()
                 throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any
Overrides:
endDocument in class EventFilter
Tags copied from interface: ContentHandler
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.startDocument()

startDTD

public void startDTD(java.lang.String root,
                     java.lang.String p,
                     java.lang.String s)
              throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any
Overrides:
startDTD in class EventFilter
Tags copied from interface: LexicalHandler
Parameters:
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.
Throws:
SAXException - The application may raise an exception.
See Also:
LexicalHandler.endDTD(), LexicalHandler.startEntity(java.lang.String)

endDTD

public void endDTD()
            throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any
Overrides:
endDTD in class EventFilter
Tags copied from interface: LexicalHandler
Throws:
SAXException - The application may raise an exception.
See Also:
LexicalHandler.startDTD(java.lang.String, java.lang.String, java.lang.String)

startCDATA

public void startCDATA()
                throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any
Overrides:
startCDATA in class EventFilter
Tags copied from interface: LexicalHandler
Throws:
SAXException - The application may raise an exception.
See Also:
LexicalHandler.endCDATA()

endCDATA

public void endCDATA()
              throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any
Overrides:
endCDATA in class EventFilter
Tags copied from interface: LexicalHandler
Throws:
SAXException - The application may raise an exception.
See Also:
LexicalHandler.startCDATA()