2005/5/9

     
 

class XMLFilterImpl

artefaktur
Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   Namespace Members   Compound Members   Related Pages  

org::xml::sax::helpers::XMLFilterImpl Class Reference

#include <XMLFilterImpl.h>

Inheritance diagram for org::xml::sax::helpers::XMLFilterImpl:

org::xml::sax::XMLFilter org::xml::sax::EntityResolver org::xml::sax::DTDHandler org::xml::sax::ContentHandler org::xml::sax::ErrorHandler List of all members.

Public Member Functions

 XMLFilterImpl ()
 XMLFilterImpl (IN(RXMLReader) parent)
virtual void setParent (IN(RXMLReader) parent)
 Set the parent reader.

virtual RXMLReader getParent ()
 Get the parent reader.

virtual void setFeature (IN(RString) name, bool state) throw ( RSAXNotRecognizedException , RSAXNotSupportedException )
 Set the value of a feature flag.

virtual bool getFeature (IN(RString) name) throw ( RSAXNotRecognizedException , RSAXNotSupportedException )
 Look up the value of a feature flag.

virtual void setProperty (IN(RString) name, IN(acdk::lang::Object) value) throw ( RSAXNotRecognizedException , RSAXNotSupportedException )
 Set the value of a property.

virtual acdk::lang::Object getProperty (IN(RString) name) throw ( RSAXNotRecognizedException , RSAXNotSupportedException )
 Look up the value of a property.

virtual void setEntityResolver (IN(REntityResolver) resolver)
 Allow an application to register an entity resolver.

virtual REntityResolver getEntityResolver ()
 Return the current entity resolver.

virtual void setDTDHandler (IN(RDTDHandler) handler)
 Allow an application to register a DTD event handler.

virtual RDTDHandler getDTDHandler ()
 Return the current DTD handler.

virtual void setContentHandler (IN(RContentHandler) handler)
 Allow an application to register a content event handler.

virtual RContentHandler getContentHandler ()
 Return the current content handler.

virtual void setErrorHandler (IN(RErrorHandler) handler)
 Allow an application to register an error event handler.

virtual RErrorHandler getErrorHandler ()
 Return the current error handler.

virtual void parse (IN(RInputSource) input) throw ( RSAXException , acdk::io::RIOException )
 Parse an XML document.

virtual void parse (IN(RString) systemId) throw ( RSAXException , acdk::io::RIOException )
 Parse an XML document from a system identifier (URI).

virtual RInputSource resolveEntity (IN(RString) publicId, IN(RString) systemId) throw ( RSAXException , acdk::io::RIOException )
virtual void notationDecl (IN(RString) name, IN(RString) publicId, IN(RString) systemId) throw ( RSAXException )
 Receive notification of a notation declaration event.

virtual void unparsedEntityDecl (IN(RString) name, IN(RString) publicId, IN(RString) systemId, IN(RString) notationName) throw ( RSAXException )
 Receive notification of an unparsed entity declaration event.

virtual void setDocumentLocator (IN(RLocator) locator)
 Receive an object for locating the origin of SAX document events.

virtual void startDocument () throw ( RSAXException )
 Receive notification of the beginning of a document.

virtual void endDocument () throw ( RSAXException )
 Receive notification of the end of a document.

virtual void startPrefixMapping (IN(RString) prefix, IN(RString) uri) throw ( RSAXException )
virtual void endPrefixMapping (IN(RString) prefix) throw ( RSAXException )
virtual void startElement (IN(RString) uri, IN(RString) localName, IN(RString) qName, IN(RAttributes) atts) throw ( RSAXException )
virtual void endElement (IN(RString) uri, IN(RString) localName, IN(RString) qName) throw ( RSAXException )
virtual void characters (IN(RString) chars) throw ( RSAXException )
virtual void ignorableWhitespace (IN(acdk::lang::RString) chars) throw ( RSAXException )
 Receive notification of ignorable whitespace in element content.

void processingInstruction (IN(RString) target, IN(RString) data) throw ( RSAXException )
void skippedEntity (IN(RString) name) throw ( RSAXException )
void warning (IN(RSAXParseException) e) throw ( RSAXException )
 Receive notification of a warning.

void error (IN(RSAXParseException) e) throw ( RSAXException )
 Receive notification of a recoverable error.

void fatalError (IN(RSAXParseException) e) throw ( RSAXException )
 Receive notification of a non-recoverable error.


Protected Attributes

RXMLReader _parent
RLocator _locator
REntityResolver _entityResolver
RDTDHandler _dtdHandler
RContentHandler _contentHandler
RErrorHandler _errorHandler

Private Member Functions

void _setupParse ()

Constructor & Destructor Documentation

org::xml::sax::helpers::XMLFilterImpl::XMLFilterImpl  )  [inline]
 

org::xml::sax::helpers::XMLFilterImpl::XMLFilterImpl IN(RXMLReader parent  )  [inline]
 


Member Function Documentation

void org::xml::sax::helpers::XMLFilterImpl::_setupParse  )  [inline, private]
 

virtual void org::xml::sax::helpers::XMLFilterImpl::characters IN(RString chars  )  throw ( RSAXException ) [inline, virtual]
 

virtual void org::xml::sax::helpers::XMLFilterImpl::endDocument  )  throw ( RSAXException ) [inline, virtual]
 

Receive notification of the end of a document.

The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.

Exceptions:
org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
See also:
startDocument

Implements org::xml::sax::ContentHandler.

virtual void org::xml::sax::helpers::XMLFilterImpl::endElement IN(RString uri,
IN(RString localName,
IN(RString qName
throw ( RSAXException ) [inline, virtual]
 

virtual void org::xml::sax::helpers::XMLFilterImpl::endPrefixMapping IN(RString prefix  )  throw ( RSAXException ) [inline, virtual]
 

void org::xml::sax::helpers::XMLFilterImpl::error IN(RSAXParseException e  )  throw ( RSAXException ) [inline, virtual]
 

Receive notification of a recoverable error.

This corresponds to the definition of error in section 1.2 of the W3C XML 1.0 Recommendation. For example, a validating parser would use this callback to report the violation of a validity constraint. The default behaviour is to take no action.

The SAX parser must continue to provide normal parsing events after invoking this method: it should still be possible for the application to process the document through to the end. If the application cannot do so, then the parser should report a fatal error even if the XML 1.0 recommendation does not require it to do so.

Filters may use this method to report other, non-XML errors as well.

Parameters:
exception The error information encapsulated in a SAX parse exception.
Exceptions:
org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
See also:
org::xml::sax::SAXParseException

Implements org::xml::sax::ErrorHandler.

void org::xml::sax::helpers::XMLFilterImpl::fatalError IN(RSAXParseException e  )  throw ( RSAXException ) [inline, virtual]
 

Receive notification of a non-recoverable error.

This corresponds to the definition of fatal error in section 1.2 of the W3C XML 1.0 Recommendation. For example, a parser would use this callback to report the violation of a well-formedness constraint.

The application must assume that the document is unusable after the parser has invoked this method, and should continue (if at all) only for the sake of collecting addition error messages: in fact, SAX parsers are free to stop reporting any other events once this method has been invoked.

Parameters:
exception The error information encapsulated in a SAX parse exception.
Exceptions:
org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
See also:
org::xml::sax::SAXParseException

Implements org::xml::sax::ErrorHandler.

virtual RContentHandler org::xml::sax::helpers::XMLFilterImpl::getContentHandler  )  [inline, virtual]
 

Return the current content handler.

Returns:
The current content handler, or null if none has been registered.
See also:
setContentHandler

Implements org::xml::sax::XMLReader.

virtual RDTDHandler org::xml::sax::helpers::XMLFilterImpl::getDTDHandler  )  [inline, virtual]
 

Return the current DTD handler.

Returns:
The current DTD handler, or null if none has been registered.
See also:
setDTDHandler

Implements org::xml::sax::XMLReader.

virtual REntityResolver org::xml::sax::helpers::XMLFilterImpl::getEntityResolver  )  [inline, virtual]
 

Return the current entity resolver.

Returns:
The current entity resolver, or null if none has been registered.
See also:
setEntityResolver

Implements org::xml::sax::XMLReader.

virtual RErrorHandler org::xml::sax::helpers::XMLFilterImpl::getErrorHandler  )  [inline, virtual]
 

Return the current error handler.

Returns:
The current error handler, or null if none has been registered.
See also:
setErrorHandler

Implements org::xml::sax::XMLReader.

virtual bool org::xml::sax::helpers::XMLFilterImpl::getFeature IN(RString name  )  throw ( RSAXNotRecognizedException , RSAXNotSupportedException ) [inline, virtual]
 

Look up the value of a feature flag.

The feature name is any fully-qualified URI. It is possible for an XMLReader to recognize a feature name but temporarily be unable to return its value. Some feature values may be available only in specific contexts, such as before, during, or after a parse. Also, some feature values may not be programmatically accessible. (In the case of an adapter for SAX1 Parser, there is no implementation-independent way to expose whether the underlying parser is performing validation, expanding external entities, and so forth.)

All XMLReaders are required to recognize the http://xml.org/sax/features/namespaces and the http://xml.org/sax/features/namespace-prefixes feature names.

Typical usage is something like this:

XMLReader r = new MySAXDriver();

// try to activate validation try { r.setFeature(http://xml.org/sax/features/validation, true); } catch (SAXException e) { System.err.println(Cannot activate validation.); }

// register event handlers r.setContentHandler(new MyContentHandler()); r.setErrorHandler(new MyErrorHandler());

// parse the first document try { r.parse(http://www.foo.com/mydoc.xml); } catch (IOException e) { System.err.println(I/O exception reading XML document); } catch (SAXException e) { System.err.println(XML exception reading document.); }

Implementors are free (and encouraged) to invent their own features, using names built on their own URIs.

Parameters:
name The feature name, which is a fully-qualified URI.
Returns:
The current value of the feature (true or false).
Exceptions:
org.xml.sax.SAXNotRecognizedException If the feature value can't be assigned or retrieved.
org.xml.sax.SAXNotSupportedException When the XMLReader recognizes the feature name but cannot determine its value at this time.
See also:
setFeature

Implements org::xml::sax::XMLReader.

virtual RXMLReader org::xml::sax::helpers::XMLFilterImpl::getParent  )  [inline, virtual]
 

Get the parent reader.

This method allows the application to query the parent reader (which may be another filter). It is generally a bad idea to perform any operations on the parent reader directly: they should all pass through this filter.

Returns:
The parent filter, or null if none has been set.

Implements org::xml::sax::XMLFilter.

virtual acdk::lang::Object org::xml::sax::helpers::XMLFilterImpl::getProperty IN(RString name  )  throw ( RSAXNotRecognizedException , RSAXNotSupportedException ) [inline, virtual]
 

Look up the value of a property.

The property name is any fully-qualified URI. It is possible for an XMLReader to recognize a property name but temporarily be unable to return its value. Some property values may be available only in specific contexts, such as before, during, or after a parse.

XMLReaders are not required to recognize any specific property names, though an initial core set is documented for SAX2.

Implementors are free (and encouraged) to invent their own properties, using names built on their own URIs.

Parameters:
name The property name, which is a fully-qualified URI.
Returns:
The current value of the property.
Exceptions:
org.xml.sax.SAXNotRecognizedException If the property value can't be assigned or retrieved.
org.xml.sax.SAXNotSupportedException When the XMLReader recognizes the property name but cannot determine its value at this time.
See also:
setProperty

Implements org::xml::sax::XMLReader.

virtual void org::xml::sax::helpers::XMLFilterImpl::ignorableWhitespace IN(acdk::lang::RString chars  )  throw ( RSAXException ) [inline, virtual]
 

Receive notification of ignorable whitespace in element content.

Validating Parsers must use this method to report each chunk of whitespace in element content (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models.

SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.

The application must not attempt to read from the array outside of the specified range.

Parameters:
ch The characters from the XML document.
start The start position in the array.
length The number of characters to read from the array.
Exceptions:
org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
See also:
characters

Implements org::xml::sax::ContentHandler.

virtual void org::xml::sax::helpers::XMLFilterImpl::notationDecl IN(RString name,
IN(RString publicId,
IN(RString systemId
throw ( RSAXException ) [inline, virtual]
 

Receive notification of a notation declaration event.

It is up to the application to record the notation for later reference, if necessary; notations may appear as attribute values and in unparsed entity declarations, and are sometime used with processing instruction target names.

At least one of publicId and systemId must be non-null. If a system identifier is present, and it is a URL, the SAX parser must resolve it fully before passing it to the application through this event.

There is no guarantee that the notation declaration will be reported before any unparsed entities that use it.

Parameters:
name The notation name.
publicId The notation's public identifier, or null if none was given.
systemId The notation's system identifier, or null if none was given.
Exceptions:
org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
See also:
unparsedEntityDecl

org::xml::sax::Attributes

Implements org::xml::sax::DTDHandler.

virtual void org::xml::sax::helpers::XMLFilterImpl::parse IN(RString systemId  )  throw ( RSAXException , acdk::io::RIOException ) [inline, virtual]
 

Parse an XML document from a system identifier (URI).

This method is a shortcut for the common case of reading a document from a system identifier. It is the exact equivalent of the following:

parse(new InputSource(systemId));

If the system identifier is a URL, it must be fully resolved by the application before it is passed to the parser.

Parameters:
systemId The system identifier (URI).
Exceptions:
org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
java.io.IOException An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
See also:
parse(org::xml::sax::InputSource)

Implements org::xml::sax::XMLReader.

virtual void org::xml::sax::helpers::XMLFilterImpl::parse IN(RInputSource input  )  throw ( RSAXException , acdk::io::RIOException ) [inline, virtual]
 

Parse an XML document.

The application can use this method to instruct the XML reader to begin parsing an XML document from any valid input source (a character stream, a byte stream, or a URI).

Applications may not invoke this method while a parse is in progress (they should create a new XMLReader instead for each nested XML document). Once a parse is complete, an application may reuse the same XMLReader object, possibly with a different input source.

During the parse, the XMLReader will provide information about the XML document through the registered event handlers.

This method is synchronous: it will not return until parsing has ended. If a client application wants to terminate parsing early, it should throw an exception.

Parameters:
source The input source for the top-level of the XML document.
Exceptions:
org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
java.io.IOException An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
See also:
org::xml::sax::InputSource

parse(java.lang.String)

setEntityResolver

setDTDHandler

setContentHandler

setErrorHandler

Implements org::xml::sax::XMLReader.

void org::xml::sax::helpers::XMLFilterImpl::processingInstruction IN(RString target,
IN(RString data
throw ( RSAXException ) [inline]
 

virtual RInputSource org::xml::sax::helpers::XMLFilterImpl::resolveEntity IN(RString publicId,
IN(RString systemId
throw ( RSAXException , acdk::io::RIOException ) [inline, virtual]
 

virtual void org::xml::sax::helpers::XMLFilterImpl::setContentHandler IN(RContentHandler handler  )  [inline, virtual]
 

Allow an application to register a content event handler.

If the application does not register a content handler, all content events reported by the SAX parser will be silently ignored.

Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.

Parameters:
handler The content handler.
See also:
getContentHandler

Implements org::xml::sax::XMLReader.

virtual void org::xml::sax::helpers::XMLFilterImpl::setDocumentLocator IN(RLocator locator  )  [inline, virtual]
 

Receive an object for locating the origin of SAX document events.

SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the ContentHandler interface.

The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine.

Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.

Parameters:
locator An object that can return the location of any SAX document event.
See also:
org::xml::sax::Locator

Implements org::xml::sax::ContentHandler.

virtual void org::xml::sax::helpers::XMLFilterImpl::setDTDHandler IN(RDTDHandler handler  )  [inline, virtual]
 

Allow an application to register a DTD event handler.

If the application does not register a DTD handler, all DTD events reported by the SAX parser will be silently ignored.

Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.

Parameters:
handler The DTD handler.
See also:
getDTDHandler

Implements org::xml::sax::XMLReader.

virtual void org::xml::sax::helpers::XMLFilterImpl::setEntityResolver IN(REntityResolver resolver  )  [inline, virtual]
 

Allow an application to register an entity resolver.

If the application does not register an entity resolver, the XMLReader will perform its own default resolution.

Applications may register a new or different resolver in the middle of a parse, and the SAX parser must begin using the new resolver immediately.

Parameters:
resolver The entity resolver.
See also:
getEntityResolver

Implements org::xml::sax::XMLReader.

virtual void org::xml::sax::helpers::XMLFilterImpl::setErrorHandler IN(RErrorHandler handler  )  [inline, virtual]
 

Allow an application to register an error event handler.

If the application does not register an error handler, all error events reported by the SAX parser will be silently ignored; however, normal processing may not continue. It is highly recommended that all SAX applications implement an error handler to avoid unexpected bugs.

Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.

Parameters:
handler The error handler.
See also:
getErrorHandler

Implements org::xml::sax::XMLReader.

virtual void org::xml::sax::helpers::XMLFilterImpl::setFeature IN(RString name,
bool  state
throw ( RSAXNotRecognizedException , RSAXNotSupportedException ) [inline, virtual]
 

Set the value of a feature flag.

The feature name is any fully-qualified URI. It is possible for an XMLReader to expose a feature value but to be unable to change the current value. Some feature values may be immutable or mutable only in specific contexts, such as before, during, or after a parse.

All XMLReaders are required to support setting http://xml.org/sax/features/namespaces to true and http://xml.org/sax/features/namespace-prefixes to false.

Parameters:
name The feature name, which is a fully-qualified URI.
value The requested value of the feature (true or false).
Exceptions:
org.xml.sax.SAXNotRecognizedException If the feature value can't be assigned or retrieved.
org.xml.sax.SAXNotSupportedException When the XMLReader recognizes the feature name but cannot set the requested value.
See also:
getFeature

Implements org::xml::sax::XMLReader.

virtual void org::xml::sax::helpers::XMLFilterImpl::setParent IN(RXMLReader parent  )  [inline, virtual]
 

Set the parent reader.

This method allows the application to link the filter to a parent reader (which may be another filter). The argument may not be null.

Parameters:
parent The parent reader.

Implements org::xml::sax::XMLFilter.

virtual void org::xml::sax::helpers::XMLFilterImpl::setProperty IN(RString name,
IN(acdk::lang::Object value
throw ( RSAXNotRecognizedException , RSAXNotSupportedException ) [inline, virtual]
 

Set the value of a property.

The property name is any fully-qualified URI. It is possible for an XMLReader to recognize a property name but to be unable to change the current value. Some property values may be immutable or mutable only in specific contexts, such as before, during, or after a parse.

XMLReaders are not required to recognize setting any specific property names, though a core set is defined by SAX2.

This method is also the standard mechanism for setting extended handlers.

Parameters:
name The property name, which is a fully-qualified URI.
value The requested value for the property.
Exceptions:
org.xml.sax.SAXNotRecognizedException If the property value can't be assigned or retrieved.
org.xml.sax.SAXNotSupportedException When the XMLReader recognizes the property name but cannot set the requested value.

Implements org::xml::sax::XMLReader.

void org::xml::sax::helpers::XMLFilterImpl::skippedEntity IN(RString name  )  throw ( RSAXException ) [inline]
 

virtual void org::xml::sax::helpers::XMLFilterImpl::startDocument  )  throw ( RSAXException ) [inline, virtual]
 

Receive notification of the beginning of a document.

The SAX parser will invoke this method only once, before any other event callbacks (except for setDocumentLocator).

Exceptions:
org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
See also:
endDocument

Implements org::xml::sax::ContentHandler.

virtual void org::xml::sax::helpers::XMLFilterImpl::startElement IN(RString uri,
IN(RString localName,
IN(RString qName,
IN(RAttributes atts
throw ( RSAXException ) [inline, virtual]
 

virtual void org::xml::sax::helpers::XMLFilterImpl::startPrefixMapping IN(RString prefix,
IN(RString uri
throw ( RSAXException ) [inline, virtual]
 

virtual void org::xml::sax::helpers::XMLFilterImpl::unparsedEntityDecl IN(RString name,
IN(RString publicId,
IN(RString systemId,
IN(RString notationName
throw ( RSAXException ) [inline, virtual]
 

Receive notification of an unparsed entity declaration event.

Note that the notation name corresponds to a notation reported by the notationDecl event. It is up to the application to record the entity for later reference, if necessary; unparsed entities may appear as attribute values.

If the system identifier is a URL, the parser must resolve it fully before passing it to the application.

Exceptions:
org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
Parameters:
name The unparsed entity's name.
publicId The entity's public identifier, or null if none was given.
systemId The entity's system identifier.
notationName The name of the associated notation.
See also:
notationDecl

org::xml::sax::Attributes

Implements org::xml::sax::DTDHandler.

void org::xml::sax::helpers::XMLFilterImpl::warning IN(RSAXParseException e  )  throw ( RSAXException ) [inline, virtual]
 

Receive notification of a warning.

SAX parsers will use this method to report conditions that are not errors or fatal errors as defined by the XML 1.0 recommendation. The default behaviour is to take no action.

The SAX parser must continue to provide normal parsing events after invoking this method: it should still be possible for the application to process the document through to the end.

Filters may use this method to report other, non-XML warnings as well.

Parameters:
exception The warning information encapsulated in a SAX parse exception.
Exceptions:
org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
See also:
org::xml::sax::SAXParseException

Implements org::xml::sax::ErrorHandler.


Member Data Documentation

RContentHandler org::xml::sax::helpers::XMLFilterImpl::_contentHandler [protected]
 

RDTDHandler org::xml::sax::helpers::XMLFilterImpl::_dtdHandler [protected]
 

REntityResolver org::xml::sax::helpers::XMLFilterImpl::_entityResolver [protected]
 

RErrorHandler org::xml::sax::helpers::XMLFilterImpl::_errorHandler [protected]
 

RLocator org::xml::sax::helpers::XMLFilterImpl::_locator [protected]
 

RXMLReader org::xml::sax::helpers::XMLFilterImpl::_parent [protected]