echoxul.util.sax
Class SAXTrimmingFilter
java.lang.Object
org.xml.sax.helpers.DefaultHandler
echoxul.util.sax.SAXFilterDefaultHandler
echoxul.util.sax.SAXTrimmingFilter
- All Implemented Interfaces:
- org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.xml.sax.ext.LexicalHandler
- public class SAXTrimmingFilter
- extends SAXFilterDefaultHandler
A SAX filter that intercepts all character(...) events,
trims the passed in character array and outputs ignorableWhitespace
+ character events as appropriate.
This filter tries not to trim character
sequences within a CDATA section. It may
malfunction if multiple character(...) events
are fired in a row. This class should be
made smarter to handle that case.
- Author:
- Terry Laurenzo
Method Summary |
void |
characters(char[] ch,
int start,
int length)
|
void |
endCDATA()
|
static void |
main(java.lang.String[] args)
main method for quick debugging of a SAX event stream for an
XML input file. |
void |
startCDATA()
|
Methods inherited from class echoxul.util.sax.SAXFilterDefaultHandler |
clearParent, comment, endDocument, endDTD, endElement, endEntity, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setLexicalHandler, setParent, skippedEntity, startDocument, startDTD, startElement, startEntity, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SAXTrimmingFilter
public SAXTrimmingFilter(java.lang.Object parent)
SAXTrimmingFilter
public SAXTrimmingFilter()
startCDATA
public void startCDATA()
throws org.xml.sax.SAXException
- Specified by:
startCDATA
in interface org.xml.sax.ext.LexicalHandler
- Overrides:
startCDATA
in class SAXFilterDefaultHandler
- Throws:
org.xml.sax.SAXException
endCDATA
public void endCDATA()
throws org.xml.sax.SAXException
- Specified by:
endCDATA
in interface org.xml.sax.ext.LexicalHandler
- Overrides:
endCDATA
in class SAXFilterDefaultHandler
- Throws:
org.xml.sax.SAXException
characters
public void characters(char[] ch,
int start,
int length)
throws org.xml.sax.SAXException
- Specified by:
characters
in interface org.xml.sax.ContentHandler
- Overrides:
characters
in class SAXFilterDefaultHandler
- Throws:
org.xml.sax.SAXException
main
public static void main(java.lang.String[] args)
throws java.lang.Exception
- main method for quick debugging of a SAX event stream for an
XML input file. The first argument is the file name.
- Throws:
java.lang.Exception
Copyright © 2004 Terry Laurenzo. All Rights Reserved.