com.jdon.util.jdom
类 DataUnformatFilter

java.lang.Object
  继承者 org.xml.sax.helpers.XMLFilterImpl
      继承者 com.jdon.util.jdom.XMLFilterBase
          继承者 com.jdon.util.jdom.DataUnformatFilter
所有已实现的接口:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler, LexicalHandler, XMLFilter, XMLReader

public class DataUnformatFilter
extends XMLFilterBase

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.

另请参见:
DataFormatFilter

字段摘要
 
从类 com.jdon.util.jdom.XMLFilterBase 继承的字段
EMPTY_ATTS, LEXICAL_HANDLER_NAMES
 
构造方法摘要
DataUnformatFilter()
          Create a new filter.
DataUnformatFilter(XMLReader xmlreader)
          Create a new filter.
 
方法摘要
 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.
 void endElement(String uri, String localName, String qName)
          Filter an end element event.
 void ignorableWhitespace(char[] ch, int start, int length)
          Filter an ignorable whitespace event.
 void processingInstruction(String target, String data)
          Filter a processing instruction event.
 void reset()
          Reset the filter so that it can be reused.
protected  void saveWhitespace(char[] ch, int start, int length)
          Saves trailing whitespace.
 void startDocument()
          Filter a start document event.
 void startElement(String uri, String localName, String qName, Attributes atts)
          Filter a start element event.
 
从类 com.jdon.util.jdom.XMLFilterBase 继承的方法
characters, comment, dataElement, dataElement, dataElement, dataElement, emptyElement, emptyElement, emptyElement, emptyElement, endCDATA, endDTD, endElement, endElement, endEntity, getLexicalHandler, getProperty, parse, setLexicalHandler, setProperty, startCDATA, startDTD, startElement, startElement, startElement, startEntity
 
从类 org.xml.sax.helpers.XMLFilterImpl 继承的方法
endDocument, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, notationDecl, parse, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

DataUnformatFilter

public DataUnformatFilter()
Create a new filter.


DataUnformatFilter

public DataUnformatFilter(XMLReader xmlreader)
Create a new filter.

Use the XMLReader provided as the source of events.

参数:
xmlreader - The parent in the filter chain.
方法详细信息

reset

public void reset()
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.


startDocument

public void startDocument()
                   throws SAXException
Filter a start document event.

Reset state and pass the event on for further processing.

指定者:
接口 ContentHandler 中的 startDocument
覆盖:
XMLFilterImpl 中的 startDocument
抛出:
SAXException - If a filter further down the chain raises an exception.
另请参见:
ContentHandler.startDocument()

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Filter a start element event.

指定者:
接口 ContentHandler 中的 startElement
覆盖:
XMLFilterImpl 中的 startElement
参数:
uri - The element's Namespace URI.
localName - The element's local name.
qName - The element's qualified (prefixed) name.
atts - The element's attribute list.
抛出:
SAXException - If a filter further down the chain raises an exception.
另请参见:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
                throws SAXException
Filter an end element event.

指定者:
接口 ContentHandler 中的 endElement
覆盖:
XMLFilterImpl 中的 endElement
参数:
uri - The element's Namespace URI.
localName - The element's local name.
qName - The element's qualified (prefixed) name.
抛出:
SAXException - If a filter further down the chain raises an exception.
另请参见:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Filter a character data event.

指定者:
接口 ContentHandler 中的 characters
覆盖:
XMLFilterImpl 中的 characters
参数:
ch - The characters to write.
start - The starting position in the array.
length - The number of characters to use.
抛出:
SAXException - If a filter further down the chain raises an exception.
另请参见:
ContentHandler.characters(char[], int, int)

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
Filter an ignorable whitespace event.

指定者:
接口 ContentHandler 中的 ignorableWhitespace
覆盖:
XMLFilterImpl 中的 ignorableWhitespace
参数:
ch - The array of characters to write.
start - The starting position in the array.
length - The number of characters to write.
抛出:
SAXException - If a filter further down the chain raises an exception.
另请参见:
ContentHandler.ignorableWhitespace(char[], int, int)

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
Filter a processing instruction event.

指定者:
接口 ContentHandler 中的 processingInstruction
覆盖:
XMLFilterImpl 中的 processingInstruction
参数:
target - The PI target.
data - The PI data.
抛出:
SAXException - If a filter further down the chain raises an exception.
另请参见:
ContentHandler.processingInstruction(java.lang.String, java.lang.String)

saveWhitespace

protected void saveWhitespace(char[] ch,
                              int start,
                              int length)
Saves trailing whitespace.


emitWhitespace

protected void emitWhitespace()
                       throws SAXException
Passes saved whitespace down the filter chain.

抛出:
SAXException

clearWhitespace

protected void clearWhitespace()
Discards saved whitespace.



Copyright © 2013. All Rights Reserved.