| sax.XMLFilterBase sax.DataUnformatFilter
DataUnformatFilter | public class DataUnformatFilter extends XMLFilterBase (Code) | | Filter for removing formatting from data- or field-oriented XML.
Code and comments adapted from DataWriter-0.2, written
by David Megginson and released into the public domain,
without warranty.
This filter removes leading and trailing whitespace from
field-oriented XML without mixed content. Note that this class will
likely not yield appropriate results for document-oriented XML like
XHTML pages, which mix character data and elements together.
See Also: DataFormatFilter |
Method Summary | |
public void | characters(char ch, int start, int length) Filter a character data event. | protected void | clearWhitespace() Discards saved whitespace. | protected void | emitWhitespace() Passes saved whitespace down the filter chain. | public void | endElement(String uri, String localName, String qName) Filter an end element event. | public void | ignorableWhitespace(char ch, int start, int length) Filter an ignorable whitespace event. | public void | processingInstruction(String target, String data) Filter a processing instruction event. | public void | reset() Reset the filter so that it can be reused. | protected void | saveWhitespace(char[] ch, int start, int length) Saves trailing whitespace. | public void | startDocument() Filter a start document event. | public void | startElement(String uri, String localName, String qName, Attributes atts) Filter a start element event. |
DataUnformatFilter | public DataUnformatFilter()(Code) | | Create a new filter.
|
DataUnformatFilter | public DataUnformatFilter(XMLReader xmlreader)(Code) | | Create a new filter.
Use the XMLReader provided as the source of events.
Parameters: xmlreader - The parent in the filter chain. |
characters | public void characters(char ch, int start, int length) throws SAXException(Code) | | Filter a character data event.
Parameters: ch - The characters to write. Parameters: start - The starting position in the array. Parameters: length - The number of characters to use. exception: org.xml.sax.SAXException - If a filterfurther down the chain raises an exception. See Also: org.xml.sax.ContentHandler.characters |
clearWhitespace | protected void clearWhitespace()(Code) | | Discards saved whitespace.
|
emitWhitespace | protected void emitWhitespace() throws SAXException(Code) | | Passes saved whitespace down the filter chain.
|
ignorableWhitespace | public void ignorableWhitespace(char ch, int start, int length) throws SAXException(Code) | | Filter an ignorable whitespace event.
Parameters: ch - The array of characters to write. Parameters: start - The starting position in the array. Parameters: length - The number of characters to write. exception: org.xml.sax.SAXException - If a filterfurther down the chain raises an exception. See Also: org.xml.sax.ContentHandler.ignorableWhitespace |
reset | public void reset()(Code) | | Reset the filter so that it can be reused.
This method is especially useful if the filter failed
with an exception the last time through.
|
saveWhitespace | protected void saveWhitespace(char[] ch, int start, int length)(Code) | | Saves trailing whitespace.
|
Methods inherited from sax.XMLFilterBase | public void characters(String data) throws SAXException(Code)(Java Doc) public void comment(char[] ch, int start, int length) throws SAXException(Code)(Java Doc) public void dataElement(String uri, String localName, String qName, Attributes atts, String content) throws SAXException(Code)(Java Doc) public void dataElement(String uri, String localName, String content) throws SAXException(Code)(Java Doc) public void dataElement(String localName, Attributes atts, String content) throws SAXException(Code)(Java Doc) public void dataElement(String localName, String content) throws SAXException(Code)(Java Doc) public void emptyElement(String uri, String localName, String qName, Attributes atts) throws SAXException(Code)(Java Doc) public void emptyElement(String uri, String localName) throws SAXException(Code)(Java Doc) public void emptyElement(String localName, Attributes atts) throws SAXException(Code)(Java Doc) public void emptyElement(String localName) throws SAXException(Code)(Java Doc) public void endCDATA() throws SAXException(Code)(Java Doc) public void endDTD() throws SAXException(Code)(Java Doc) public void endElement(String uri, String localName) throws SAXException(Code)(Java Doc) public void endElement(String localName) throws SAXException(Code)(Java Doc) public void endEntity(String name) throws SAXException(Code)(Java Doc) public LexicalHandler getLexicalHandler()(Code)(Java Doc) public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException(Code)(Java Doc) public void parse(InputSource input) throws SAXException, IOException(Code)(Java Doc) public void setLexicalHandler(LexicalHandler handler)(Code)(Java Doc) public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException(Code)(Java Doc) public void startCDATA() throws SAXException(Code)(Java Doc) public void startDTD(String name, String publicId, String systemId) throws SAXException(Code)(Java Doc) public void startElement(String uri, String localName) throws SAXException(Code)(Java Doc) public void startElement(String localName, Attributes atts) throws SAXException(Code)(Java Doc) public void startElement(String localName) throws SAXException(Code)(Java Doc) public void startEntity(String name) throws SAXException(Code)(Java Doc)
|
|
|