Package eu.bandm.tools.dtd
Class WhitespaceIgnorer
java.lang.Object
eu.bandm.tools.util.xml.ContentProxy
eu.bandm.tools.dtd.WhitespaceIgnorer
- All Implemented Interfaces:
ContentHandler
A Sax filter which recognizes character data as "ignorable white space",
according to a dtd, and feeds them into
ContentHandler.ignorableWhitespace(char[], int, int)
.
Currently only used in
xantlrtdom.TdomReader
ATTENTION does not care for namespaces, but requires "qname" (i.e. prefix
plus ":" plus localname) of the SAX event to be identical to the
element name in the DTD.-
Field Summary
Fields inherited from class eu.bandm.tools.util.xml.ContentProxy
out
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
characters
(char[] ch, int start, int len) void
endElement
(String uri, String localName, String qName) static boolean
ignorable
(char[] ch, int start, int len) Fundamental predicate, decides whether character data is whitespace.static boolean
void
startElement
(String uri, String localName, String qName, Attributes attrs) Methods inherited from class eu.bandm.tools.util.xml.ContentProxy
endDocument, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Constructor Details
-
WhitespaceIgnorer
Only constructor.- Parameters:
dtd
- the dtd which rules the ignoring/respecting of whitespace.out
- target to which the sax events will be propagated.
-
-
Method Details
-
startElement
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException - Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classContentProxy
- Throws:
SAXException
-
characters
- Specified by:
characters
in interfaceContentHandler
- Overrides:
characters
in classContentProxy
- Throws:
SAXException
-
ignorable
public static boolean ignorable(char[] ch, int start, int len) Fundamental predicate, decides whether character data is whitespace. This is according to the xml standard "x20,x09,x0A,x0D". (see [XSLT 1.0:3.4]) Nevertheless "x0D" and "x0Dx0A" should have been replaced by a single "x0A" in advance! -
ignorable
-
endElement
- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classContentProxy
- Throws:
SAXException
-