gnu.xml.pipeline
Class WellFormednessFilter
- ContentHandler, ContentHandler2, DeclHandler, DTDHandler, EventConsumer, LexicalHandler
public final class WellFormednessFilter
This filter reports fatal exceptions in the case of event streams that
are not well formed. The rules currently tested include:
- setDocumentLocator ... may be called only before startDocument
- startDocument/endDocument ... must be paired, and all other
calls (except setDocumentLocator) must be nested within these.
- startElement/endElement ... must be correctly paired, and
may never appear within CDATA sections.
- comment ... can't contain "--"
- character data ... can't contain "]]>"
- whitespace ... can't contain CR
- whitespace and character data must be within an element
- processing instruction ... can't contain "?>" or CR
- startCDATA/endCDATA ... must be correctly paired.
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.
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)
|
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 |
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.
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.