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).
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(char[] ch, int start, int len) voidendElement(String uri, String localName, String qName) static booleanignorable(char[] ch, int start, int len) Fundamental predicate, decides whether character data is whitespace.static booleanvoidstartElement(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, startPrefixMappingMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
startElementin interfaceContentHandler- Overrides:
startElementin classContentProxy- Throws:
SAXException
-
characters
- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin 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:
endElementin interfaceContentHandler- Overrides:
endElementin classContentProxy- Throws:
SAXException
-