| java.lang.Object org.xml.sax.helpers.XMLFilterImpl sax.XMLFilterBase
All known Subclasses: sax.DataFormatFilter, sax.XMLWriter, sax.DataUnformatFilter,
XMLFilterBase | public class XMLFilterBase extends XMLFilterImpl implements LexicalHandler(Code) | | Adds convenience methods and lexical event filtering to base
SAX2 Filter implementation.
Code and comments adapted from XMLWriter-0.2, written
by David Megginson and released into the public domain,
without warranty.
The convenience methods are provided so that clients do not have to
create empty attribute lists or provide empty strings as parameters;
for example, the method invocation
w.startElement("foo");
is equivalent to the regular SAX2 ContentHandler method
w.startElement("", "foo", "", new AttributesImpl());
Except that it is more efficient because it does not allocate
a new empty attribute list each time.
In fact, there is an even simpler convenience method,
dataElement, designed for writing elements that
contain only character data.
w.dataElement("greeting", "Hello, world!");
is equivalent to
w.startElement("greeting");
w.characters("Hello, world!");
w.endElement("greeting");
See Also: org.xml.sax.helpers.XMLFilterImpl |
Method Summary | |
public void | characters(String data) Add a string of character data, with XML escaping. | public void | comment(char[] ch, int start, int length) | public void | dataElement(String uri, String localName, String qName, Attributes atts, String content) Add an element with character data content. | public void | dataElement(String uri, String localName, String content) Add an element with character data content but no qname or attributes.
This is a convenience method to add a complete element
with character data content, including the start tag
and end tag. | public void | dataElement(String localName, Attributes atts, String content) Add an element with character data content but no Namespace URI or qname.
This is a convenience method to add a complete element
with character data content, including the start tag
and end tag. | public void | dataElement(String localName, String content) Add an element with character data content but no attributes
or Namespace URI.
This is a convenience method to add a complete element
with character data content, including the start tag
and end tag. | public void | emptyElement(String uri, String localName, String qName, Attributes atts) Add an empty element.
Both a
XMLFilterBase.startElement startElement and an
XMLFilterBase.endElement endElement event will be passed on down
the filter chain.
Parameters: uri - The element's Namespace URI, or the empty stringif the element has no Namespace or if Namespaceprocessing is not being performed. Parameters: localName - The element's local name (without prefix). | public void | emptyElement(String uri, String localName) Add an empty element without a qname or attributes.
This method will supply an empty string for the qname
and an empty attribute list. | public void | emptyElement(String localName, Attributes atts) Add an empty element without a Namespace URI or qname. | public void | emptyElement(String localName) Add an empty element without a Namespace URI, qname or attributes.
This method will supply an empty string for the qname,
and empty string for the Namespace URI, and an empty
attribute list. | public void | endCDATA() | public void | endDTD() Filter a end DTD event. | public void | endElement(String uri, String localName) End an element without a qname. | public void | endElement(String localName) End an element without a Namespace URI or qname. | public void | endEntity(String name) | public LexicalHandler | getLexicalHandler() Get the current lexical handler. | public Object | getProperty(String name) Look up the value of a property.
Parameters: name - The property name. | public void | parse(InputSource input) Parse a document. | public void | setLexicalHandler(LexicalHandler handler) Set the lexical handler. | public void | setProperty(String name, Object value) Set the value of a property. | public void | startCDATA() | public void | startDTD(String name, String publicId, String systemId) Filter a start DTD event. | public void | startElement(String uri, String localName) Start a new element without a qname or attributes.
This method will provide a default empty attribute
list and an empty string for the qualified name. | public void | startElement(String localName, Attributes atts) Start a new element without a Namespace URI or qname. | public void | startElement(String localName) Start a new element without a Namespace URI, qname, or attributes.
This method will provide an empty string for the
Namespace URI, and empty string for the qualified name,
and a default empty attribute list. | public void | startEntity(String name) |
LEXICAL_HANDLER_NAMES | final protected static String[] LEXICAL_HANDLER_NAMES(Code) | | |
XMLFilterBase | public XMLFilterBase(XMLReader parent)(Code) | | Create an XML filter with the specified parent.
Use the XMLReader provided as the source of events.
Parameters: xmlreader - The parent in the filter chain. |
characters | public void characters(String data) throws SAXException(Code) | | Add a string of character data, with XML escaping.
This is a convenience method that takes an XML
String, converts it to a character array, then invokes
@see org.xml.sax.ContentHandler#characters .
Parameters: data - The character data. exception: org.xml.sax.SAXException - If a filterfurther down the chain raises an exception. See Also: @see org.xml.sax.ContentHandler#characters |
getLexicalHandler | public LexicalHandler getLexicalHandler()(Code) | | Get the current lexical handler.
The current lexical handler, or null if none was set. |
startDTD | public void startDTD(String name, String publicId, String systemId) throws SAXException(Code) | | Filter a start DTD event.
Parameters: name - The document type name. Parameters: publicId - The declared public identifier for theexternal DTD subset, or null if none was declared. Parameters: systemId - The declared system identifier for theexternal DTD subset, or null if none was declared. exception: org.xml.sax.SAXException - If a filterfurther down the chain raises an exception. See Also: org.xml.sax.ext.LexicalHandler.startDTD |
Methods inherited from org.xml.sax.helpers.XMLFilterImpl | public void characters(char ch, int start, int length) throws SAXException(Code)(Java Doc) public void endDocument() throws SAXException(Code)(Java Doc) public void endElement(String uri, String localName, String qName) throws SAXException(Code)(Java Doc) public void endPrefixMapping(String prefix) throws SAXException(Code)(Java Doc) public void error(SAXParseException e) throws SAXException(Code)(Java Doc) public void fatalError(SAXParseException e) throws SAXException(Code)(Java Doc) public ContentHandler getContentHandler()(Code)(Java Doc) public DTDHandler getDTDHandler()(Code)(Java Doc) public EntityResolver getEntityResolver()(Code)(Java Doc) public ErrorHandler getErrorHandler()(Code)(Java Doc) public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException(Code)(Java Doc) public XMLReader getParent()(Code)(Java Doc) public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException(Code)(Java Doc) public void ignorableWhitespace(char ch, int start, int length) throws SAXException(Code)(Java Doc) public void notationDecl(String name, String publicId, String systemId) throws SAXException(Code)(Java Doc) public void parse(InputSource input) throws SAXException, IOException(Code)(Java Doc) public void parse(String systemId) throws SAXException, IOException(Code)(Java Doc) public void processingInstruction(String target, String data) throws SAXException(Code)(Java Doc) public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException(Code)(Java Doc) public void setContentHandler(ContentHandler handler)(Code)(Java Doc) public void setDTDHandler(DTDHandler handler)(Code)(Java Doc) public void setDocumentLocator(Locator locator)(Code)(Java Doc) public void setEntityResolver(EntityResolver resolver)(Code)(Java Doc) public void setErrorHandler(ErrorHandler handler)(Code)(Java Doc) public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException(Code)(Java Doc) public void setParent(XMLReader parent)(Code)(Java Doc) public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException(Code)(Java Doc) public void skippedEntity(String name) throws SAXException(Code)(Java Doc) public void startDocument() throws SAXException(Code)(Java Doc) public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException(Code)(Java Doc) public void startPrefixMapping(String prefix, String uri) throws SAXException(Code)(Java Doc) public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException(Code)(Java Doc) public void warning(SAXParseException e) throws SAXException(Code)(Java Doc)
|
|
|