gnu.xml.pipeline
Class WellFormednessFilter

java.lang.Object
  extended bygnu.xml.pipeline.EventFilter
      extended bygnu.xml.pipeline.WellFormednessFilter
All Implemented Interfaces:
ContentHandler, 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.

Version:
$Date: 2001/11/09 22:53:17 $
Author:
David Brownell

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(char[] ch, int start, int length)
          SAX2: passes this callback to the next consumer, if any
 void comment(char[] ch, int start, int length)
          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 uri, java.lang.String localName, java.lang.String qName)
          SAX2: passes this callback to the next consumer, if any
 void ignorableWhitespace(char[] ch, int start, int length)
          SAX2: passes this callback to the next consumer, if any
 void notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
          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 locator)
          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 publicId, java.lang.String systemId)
          SAX2: passes this callback to the next consumer, if any
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, Attributes atts)
          SAX2: passes this callback to the next consumer, if any
 void unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName)
          SAX1: passes this callback to the next consumer, if any
 
Methods inherited from class gnu.xml.pipeline.EventFilter
attributeDecl, bind, chainTo, 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

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 locator)
Throws an exception when called after startDocument.

Specified by:
setDocumentLocator in interface ContentHandler
Overrides:
setDocumentLocator in class EventFilter
Parameters:
locator - the locator, to be used in error reporting or relative URI resolution.
Throws:
java.lang.IllegalStateException - when called after the document has already been started

startDocument

public void startDocument()
                   throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class EventFilter
Throws:
SAXException

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         Attributes atts)
                  throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class EventFilter
Throws:
SAXException

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
                throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class EventFilter
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class EventFilter
Throws:
SAXException

startDTD

public void startDTD(java.lang.String root,
                     java.lang.String publicId,
                     java.lang.String systemId)
              throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
startDTD in interface LexicalHandler
Overrides:
startDTD in class EventFilter
Throws:
SAXException

notationDecl

public void notationDecl(java.lang.String name,
                         java.lang.String publicId,
                         java.lang.String systemId)
                  throws SAXException
Description copied from class: EventFilter
SAX1: passes this callback to the next consumer, if any

Specified by:
notationDecl in interface DTDHandler
Overrides:
notationDecl in class EventFilter
Throws:
SAXException

unparsedEntityDecl

public void unparsedEntityDecl(java.lang.String name,
                               java.lang.String publicId,
                               java.lang.String systemId,
                               java.lang.String notationName)
                        throws SAXException
Description copied from class: EventFilter
SAX1: passes this callback to the next consumer, if any

Specified by:
unparsedEntityDecl in interface DTDHandler
Overrides:
unparsedEntityDecl in class EventFilter
Throws:
SAXException

endDTD

public void endDTD()
            throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
endDTD in interface LexicalHandler
Overrides:
endDTD in class EventFilter
Throws:
SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
characters in interface ContentHandler
Overrides:
characters in class EventFilter
Throws:
SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
ignorableWhitespace in interface ContentHandler
Overrides:
ignorableWhitespace in class EventFilter
Throws:
SAXException

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
processingInstruction in interface ContentHandler
Overrides:
processingInstruction in class EventFilter
Throws:
SAXException

comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
comment in interface LexicalHandler
Overrides:
comment in class EventFilter
Throws:
SAXException

startCDATA

public void startCDATA()
                throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
startCDATA in interface LexicalHandler
Overrides:
startCDATA in class EventFilter
Throws:
SAXException

endCDATA

public void endCDATA()
              throws SAXException
Description copied from class: EventFilter
SAX2: passes this callback to the next consumer, if any

Specified by:
endCDATA in interface LexicalHandler
Overrides:
endCDATA in class EventFilter
Throws:
SAXException


Source code is under GPL (with library exception) in the JAXP project at http://www.gnu.org/software/classpathx/jaxp
This documentation was derived from that source code on 2008-10-18.