Class XMLFilter
Base class for deriving an XML filter.
This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY. See http://www.saxproject.org for further information. This class is designed to sit between an IXMLReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.Inherited Members
Namespace: Sax.Helpers
Assembly: Lucene.Net.Benchmark.dll
Syntax
public class XMLFilter : IXMLFilter, IXMLReader, IEntityResolver, IDTDHandler, IContentHandler, IErrorHandler
Constructors
XMLFilter()
Construct an empty XML filter, with no parent.
This filter will have no parent: you must assign a parent before you start a parse or do any configuration with setFeature or setProperty, unless you use this as a pure event consumer rather than as an IXMLReader.
Declaration
public XMLFilter()
See Also
XMLFilter(IXMLReader)
Construct an XML filter with the specified parent.
Declaration
public XMLFilter(IXMLReader parent)
Parameters
Type | Name | Description |
---|---|---|
IXMLReader | parent | The parent |
See Also
Properties
ContentHandler
Gets or Sets the content event handler.
Declaration
public IContentHandler ContentHandler { get; set; }
Property Value
Type | Description |
---|---|
IContentHandler |
See Also
DTDHandler
Gets or Sets the DTD event handler.
Declaration
public IDTDHandler DTDHandler { get; set; }
Property Value
Type | Description |
---|---|
IDTDHandler |
See Also
EntityResolver
Gets or Sets the entity resolver.
Declaration
public IEntityResolver EntityResolver { get; set; }
Property Value
Type | Description |
---|---|
IEntityResolver |
See Also
ErrorHandler
Gets or Sets the error event handler.
Declaration
public IErrorHandler ErrorHandler { get; set; }
Property Value
Type | Description |
---|---|
IErrorHandler |
See Also
Parent
Gets or sets the parent reader.
Declaration
public IXMLReader Parent { get; set; }
Property Value
Type | Description |
---|---|
IXMLReader |
Remarks
This is the IXMLReader from which this filter will obtain its events and to which it will pass its configuration requests. The parent may itself be another filter.
If there is no parent reader set, any attempt to parse or to set or get a feature or property will fail.See Also
Methods
Characters(char[], int, int)
Filter a character data event.
Declaration
public virtual void Characters(char[] ch, int start, int length)
Parameters
Type | Name | Description |
---|---|---|
char[] | ch | An array of characters. |
int | start | The starting position in the array. |
int | length | The number of characters to use from the array. |
Exceptions
Type | Condition |
---|---|
SAXException | The client may throw an exception during processing. |
See Also
EndDocument()
Filter an end document event.
Declaration
public virtual void EndDocument()
Exceptions
Type | Condition |
---|---|
SAXException | The client may throw an exception during processing. |
See Also
EndElement(string, string, string)
Filter an end element event.
Declaration
public virtual void EndElement(string uri, string localName, string qName)
Parameters
Type | Name | Description |
---|---|---|
string | uri | The element's Namespace URI, or the empty string. |
string | localName | The element's local name, or the empty string. |
string | qName | The element's qualified (prefixed) name, or the empty string. |
Exceptions
Type | Condition |
---|---|
SAXException | The client may throw an exception during processing. |
See Also
EndPrefixMapping(string)
Filter an end Namespace prefix mapping event.
Declaration
public virtual void EndPrefixMapping(string prefix)
Parameters
Type | Name | Description |
---|---|---|
string | prefix | The Namespace prefix. |
Exceptions
Type | Condition |
---|---|
SAXException | The client may throw an exception during processing. |
See Also
Error(SAXParseException)
Filter an error event.
Declaration
public virtual void Error(SAXParseException e)
Parameters
Type | Name | Description |
---|---|---|
SAXParseException | e | The error as an exception. |
Exceptions
Type | Condition |
---|---|
SAXException | The client may throw an exception during processing. |
See Also
FatalError(SAXParseException)
Filter a fatal error event.
Declaration
public virtual void FatalError(SAXParseException e)
Parameters
Type | Name | Description |
---|---|---|
SAXParseException | e | The error as an exception. |
Exceptions
Type | Condition |
---|---|
SAXException | The client may throw an exception during processing. |
See Also
GetFeature(string)
Look up the value of a feature.
This will always fail if the parent is null.Declaration
public virtual bool GetFeature(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The feature name. |
Returns
Type | Description |
---|---|
bool | The current value of the feature. |
Exceptions
Type | Condition |
---|---|
SAXNotRecognizedException | If the feature value can't be assigned or retrieved from the parent. |
SAXNotSupportedException | When the parent recognizes the feature name but cannot determine its value at this time. |
See Also
GetProperty(string)
Look up the value of a property.
Declaration
public virtual object GetProperty(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The property name. |
Returns
Type | Description |
---|---|
object | The current value of the property. |
Exceptions
Type | Condition |
---|---|
SAXNotRecognizedException | If the property value can't be assigned or retrieved from the parent. |
SAXNotSupportedException | When the parent recognizes the property name but cannot determine its value at this time. |
See Also
IgnorableWhitespace(char[], int, int)
Filter an ignorable whitespace event.
Declaration
public virtual void IgnorableWhitespace(char[] ch, int start, int length)
Parameters
Type | Name | Description |
---|---|---|
char[] | ch | An array of characters. |
int | start | The starting position in the array. |
int | length | The number of characters to use from the array. |
Exceptions
Type | Condition |
---|---|
SAXException | The client may throw an exception during processing. |
See Also
NotationDecl(string, string, string)
Filter a notation declaration event.
Declaration
public virtual void NotationDecl(string name, string publicId, string systemId)
Parameters
Type | Name | Description |
---|---|---|
string | name | The notation name. |
string | publicId | The notation's public identifier, or null. |
string | systemId | The notation's system identifier, or null. |
See Also
Parse(InputSource)
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. Configuration of the XMLReader object (such as handler bindings and values established for feature flags and properties) is unchanged by completion of a parse, unless the definition of that aspect of the configuration explicitly specifies other behavior. (For example, feature flags or properties exposing characteristics of the document being parsed.)
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.
Declaration
public virtual void Parse(InputSource input)
Parameters
Type | Name | Description |
---|---|---|
InputSource | input | The input source for the top-level of the XML document. |
Exceptions
Type | Condition |
---|---|
SAXException | Any SAX exception, possibly wrapping another exception. |
IOException | An IO exception from the parser, possibly from a byte stream or character stream supplied by the application. |
See Also
Parse(string)
Parse a document.
Declaration
public virtual void Parse(string systemId)
Parameters
Type | Name | Description |
---|---|---|
string | systemId | The system identifier as a fully-qualified URI. |
Exceptions
Type | Condition |
---|---|
SAXException | Any SAX exception, possibly wrapping another exception. |
IOException | An IO exception from the parser, possibly from a byte stream or character stream supplied by the application. |
See Also
ProcessingInstruction(string, string)
Filter a processing instruction event.
Declaration
public virtual void ProcessingInstruction(string target, string data)
Parameters
Type | Name | Description |
---|---|---|
string | target | The processing instruction target. |
string | data | The text following the target. |
Exceptions
Type | Condition |
---|---|
SAXException | The client may throw an exception during processing. |
See Also
ResolveEntity(string, string)
Filter an external entity resolution.
Declaration
public virtual InputSource ResolveEntity(string publicId, string systemId)
Parameters
Type | Name | Description |
---|---|---|
string | publicId | The entity's public identifier, or null. |
string | systemId | The entity's system identifier. |
Returns
Type | Description |
---|---|
InputSource | A new InputSource or null for the default. |
Exceptions
Type | Condition |
---|---|
SAXException | The client may throw an exception during processing. |
IOException | The client may throw an I/O-related exception while obtaining the new InputSource. |
See Also
SetDocumentLocator(ILocator)
Filter a new document locator event.
Declaration
public virtual void SetDocumentLocator(ILocator locator)
Parameters
Type | Name | Description |
---|---|---|
ILocator | locator | The document locator. |
See Also
SetFeature(string, bool)
Set the value of a feature.
This will always fail if the parent is null.Declaration
public virtual void SetFeature(string name, bool value)
Parameters
Type | Name | Description |
---|---|---|
string | name | The feature name. |
bool | value | The requested feature value. |
Exceptions
Type | Condition |
---|---|
SAXNotRecognizedException | If the feature value can't be assigned or retrieved from the parent. |
SAXNotSupportedException | When the parent recognizes the feature name but cannot set the requested value. |
See Also
SetProperty(string, object)
Set the value of a property.
This will always fail if the parent is null.Declaration
public virtual void SetProperty(string name, object value)
Parameters
Type | Name | Description |
---|---|---|
string | name | The property name. |
object | value | The requested property value. |
Exceptions
Type | Condition |
---|---|
SAXNotRecognizedException | If the property value can't be assigned or retrieved from the parent. |
SAXNotSupportedException | When the parent recognizes the property name but cannot set the requested value. |
See Also
SkippedEntity(string)
Filter a skipped entity event.
Declaration
public virtual void SkippedEntity(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the skipped entity. |
Exceptions
Type | Condition |
---|---|
SAXException | The client may throw an exception during processing. |
See Also
StartDocument()
Filter a start document event.
Declaration
public virtual void StartDocument()
Exceptions
Type | Condition |
---|---|
SAXException | The client may throw an exception during processing. |
See Also
StartElement(string, string, string, IAttributes)
Filter a start element event.
Declaration
public virtual void StartElement(string uri, string localName, string qName, IAttributes atts)
Parameters
Type | Name | Description |
---|---|---|
string | uri | The element's Namespace URI, or the empty string. |
string | localName | The element's local name, or the empty string. |
string | qName | The element's qualified (prefixed) name, or the empty string. |
IAttributes | atts | The element's attributes. |
Exceptions
Type | Condition |
---|---|
SAXException | The client may throw an exception during processing. |
See Also
StartPrefixMapping(string, string)
Filter a start Namespace prefix mapping event.
Declaration
public virtual void StartPrefixMapping(string prefix, string uri)
Parameters
Type | Name | Description |
---|---|---|
string | prefix | The Namespace prefix. |
string | uri | The Namespace URI. |
Exceptions
Type | Condition |
---|---|
SAXException | The client may throw an exception during processing. |
See Also
UnparsedEntityDecl(string, string, string, string)
Filter an unparsed entity declaration event.
Declaration
public virtual void UnparsedEntityDecl(string name, string publicId, string systemId, string notationName)
Parameters
Type | Name | Description |
---|---|---|
string | name | The entity name. |
string | publicId | The entity's public identifier, or null. |
string | systemId | The entity's system identifier, or null. |
string | notationName | The name of the associated notation. |
Exceptions
Type | Condition |
---|---|
SAXException | The client may throw an exception during processing. |
See Also
Warning(SAXParseException)
Filter a warning event.
Declaration
public virtual void Warning(SAXParseException e)
Parameters
Type | Name | Description |
---|---|---|
SAXParseException | e | The warning as an exception. |
Exceptions
Type | Condition |
---|---|
SAXException | The client may throw an exception during processing. |