Class Summary : TBufferedDefaultHandler

Default base class for SAX2 Buffered event handlers.
This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY.

This class is available as a convenience base class for SAX2 applications: it provides default implementations for all of the callbacks in the four core SAX2 buffered handler classes:

Application writers can extend this class when they need to implement only part of an interface; parser writers can instantiate this class to provide default handlers when the application has not supplied its own.

This class replaces the deprecated SAX1 HandlerBase class.


Since : SAX 2.0
See : IEntityResolver
See : IBufferedDTDHandler
See : IBufferedContentHandler
See : IErrorHandler

Methods

function resolveEntity(SAXString, SAXString) : IInputSource
procedure notationDecl(PSAXChar, Integer, PSAXChar, Integer, PSAXChar, Integer)
procedure unparsedEntityDecl(PSAXChar, Integer, PSAXChar, Integer, PSAXChar, Integer, PSAXChar, Integer)
procedure setDocumentLocator(ILocator)
procedure startDocument()
procedure endDocument()
procedure startPrefixMapping(PSAXChar, Integer, PSAXChar, Integer)
procedure endPrefixMapping(PSAXChar, Integer)
procedure startElement(PSAXChar, Integer, PSAXChar, Integer, PSAXChar, Integer, IBufferedAttributes)
procedure endElement(PSAXChar, Integer, PSAXChar, Integer, PSAXChar, Integer)
procedure characters(PSAXChar, Integer)
procedure ignorableWhitespace(PSAXChar, Integer)
procedure processingInstruction(PSAXChar, Integer, PSAXChar, Integer)
procedure skippedEntity(PSAXChar, Integer)
procedure warning(ISAXParseError)
procedure error(ISAXParseError)
procedure fatalError(ISAXParseError)


function resolveEntity(const publicId : SAXString; const systemId : SAXString) : IInputSource;

Resolve an external entity.

Always return nil, so that the parser will use the system identifier provided in the XML document. This method implements the SAX default behaviour: application writers can override it in a subclass to do special translations such as catalog lookups or URI redirection.


Parameter : publicId The public identifer, or an empty string if none is available.
Parameter : systemId The system identifier provided in the XML document.
Result : The new input source, or nil to require the default behaviour.
Exception : ESAXException Any SAX exception.
See : IEntityResolver.resolveEntity

Top


procedure notationDecl( name : PSAXChar; nameLength : Integer; publicId : PSAXChar; publicIdLength : Integer; systemId : PSAXChar; systemIdLength : Integer);

Receive notification of a notation declaration.

By default, do nothing. Application writers may override this method in a subclass if they wish to keep track of the notations declared in a document.


Parameter : name The notation name.
Parameter : nameLength The length of the name buffer. The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Parameter : publicId The notation's public identifier, or empty if none was given.
Parameter : publicIdLength The length of the publicId buffer. The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Parameter : systemId The notation's system identifier, or empty if none was given.
Parameter : systemIdLength The length of the systemId buffer. The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Exception : ESAXException Any SAX exception.
See : TBufferedDefaultHandler.unparsedEntityDecl
See : IBufferedAttributes

Top


procedure unparsedEntityDecl( name : PSAXChar; nameLength : Integer; publicId : PSAXChar; publicIdLength : Integer; systemId : PSAXChar; systemIdLength : Integer; notationName : PSAXChar; notationNameLength : Integer);

Receive notification of an unparsed entity declaration.

By default, do nothing. Application writers may override this method in a subclass to keep track of the unparsed entities declared in a document.


Exception : ESAXException Any SAX exception.
Parameter : name The unparsed entity's name.
Parameter : nameLength The length of the name buffer. The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Parameter : publicId The entity's public identifier, or empty if none was given.
Parameter : publicIdLength The length of the publicId buffer. The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Parameter : systemId The entity's system identifier.
Parameter : systemIdLength The length of the systemId buffer. The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Parameter : notationName The name of the associated notation.
Parameter : notationNameLength The length of the notationNameLength buffer. The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
See : TBufferedDefaultHandler.notationDecl
See : IBufferedAttributes

Top


procedure setDocumentLocator(const locator : ILocator);

Receive a Locator object for document events.

By default, do nothing. Application writers may override this method in a subclass if they wish to store the locator for use with other document events.


Parameter : locator An object that can return the location of any SAX document event.
See : ILocator

Top


procedure startDocument();

Receive notification of the beginning of the document.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the beginning of a document (such as allocating the root node of a tree or creating an output file).


Exception : ESAXException Any SAX exception.
See : TBufferedDefaultHandler.endDocument

Top


procedure endDocument();

Receive notification of the end of the document.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of a document (such as finalising a tree or closing an output file).


Exception : ESAXException Any SAX exception.
See : TBufferedDefaultHandler.startDocument

Top


procedure startPrefixMapping( prefix : PSAXChar; prefixLength : Integer; uri : PSAXChar; uriLength : Integer);

Receive notification of the start of a Namespace mapping.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each Namespace prefix scope (such as storing the prefix mapping).


Parameter : prefix The Namespace prefix being declared. An empty string is used for the default element namespace, which has no prefix.
Parameter : prefixLength The length of the prefix buffer. The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Parameter : uri The Namespace URI the prefix is mapped to.
Parameter : uriLength The length of the uri buffer. The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Exception : ESAXException The client may throw an exception during processing.
See : TBufferedDefaultHandler.endPrefixMapping
See : TBufferedDefaultHandler.startElement

Top


procedure endPrefixMapping( prefix : PSAXChar; prefixLength : Integer);

Receive notification of the end of a Namespace mapping.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each prefix mapping.


Parameter : prefix The prefix that was being mapping. Use the empty string when a default mapping scope ends.
Parameter : prefixLength The length of the prefix buffer. The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Exception : ESAXException The client may throw an exception during processing.
See : TBufferedDefaultHandler.startPrefixMapping
See : TBufferedDefaultHandler.endElement

Top


procedure startElement( uri : PSAXChar; uriLength : Integer; localName : PSAXChar; localNameLength : Integer; qName : PSAXChar; qNameLength : Integer; const atts : IBufferedAttributes);

Receive notification of the start of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each element (such as allocating a new tree node or writing output to a file).


Parameter : uri The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
Parameter : uriLength The length of the uri buffer. The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Parameter : localName The local name (without prefix), or the empty string if Namespace processing is not being performed.
Parameter : localNameLength The length of the localName buffer. The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Parameter : qName The qualified name (with prefix), or the empty string if qualified names are not available.
Parameter : qNameLength The length of the qName buffer. The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Parameter : atts The attributes attached to the element. If there are no attributes, it shall be an empty IBufferedAttributes object or nil.
Exception : ESAXException Any SAX exception.
See : TBufferedDefaultHandler.endElement
See : IBufferedAttributes

Top


procedure endElement( uri : PSAXChar; uriLength : Integer; localName : PSAXChar; localNameLength : Integer; qName : PSAXChar; qNameLength : Integer);

Receive notification of the end of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each element (such as finalising a tree node or writing output to a file).


Parameter : uri The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
Parameter : uriLength The length of the uri buffer. The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Parameter : localName The local name (without prefix), or the empty string if Namespace processing is not being performed.
Parameter : localNameLength The length of the localName buffer. The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Parameter : qName The qualified name (with prefix), or the empty string if qualified names are not available.
Parameter : qNameLength The length of the qName buffer. The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Exception : ESAXException Any SAX exception.

Top


procedure characters( ch : PSAXChar; chLength : Integer);

Receive notification of character data inside an element.

By default, do nothing. Application writers may override this method to take specific actions for each chunk of character data (such as adding the data to a node or buffer, or printing it to a file).


Parameter : ch Pointer to the characters from the XML document.
Parameter : chLength The length of the ch buffer The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Exception : ESAXException Any SAX exception.
See : TBufferedDefaultHandler.ignorableWhitespace
See : ILocator

Top


procedure ignorableWhitespace( ch : PSAXChar; chLength : Integer);

Receive notification of ignorable whitespace in element content.

By default, do nothing. Application writers may override this method to take specific actions for each chunk of ignorable whitespace (such as adding data to a node or buffer, or printing it to a file).


Parameter : ch Pointer to the characters from the XML document.
Parameter : chLength The length of the ch buffer The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Exception : ESAXException Any SAX exception.
See : TBufferedDefaultHandler.characters

Top


procedure processingInstruction( target : PSAXChar; targetLength : Integer; data : PSAXChar; dataLength : Integer);

Receive notification of a processing instruction.

By default, do nothing. Application writers may override this method in a subclass to take specific actions for each processing instruction, such as setting status variables or invoking other methods.


Parameter : target The processing instruction target.
Parameter : targetLength The length of the target buffer The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Parameter : data The processing instruction data, or the empty string if none was supplied. The data does not include any whitespace separating it from the target.
Parameter : dataLength The length of the data buffer The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Exception : ESAXException Any SAX exception.

Top


procedure skippedEntity( name : PSAXChar; nameLength : Integer);

Receive notification of a skipped entity.

By default, do nothing. Application writers may override this method in a subclass to take specific actions for each processing instruction, such as setting status variables or invoking other methods.


Parameter : name The name of the skipped entity. If it is a parameter entity, the name will begin with '%', and if it is the external DTD subset, it will be the string "[dtd]".
Parameter : nameLength The length of the name buffer The value may be -1 which indicates that the buffer is null-terminated. If the value is 0 then the buffer may be nil.
Exception : ESAXException Any SAX exception.

Top


procedure warning(const e : ISAXParseError);

Receive notification of a parser warning.

The default implementation does nothing. Application writers may override this method in a subclass to take specific actions for each warning, such as inserting the message in a log file or printing it to the console.


Parameter : e The warning information encoded as an exception.
Exception : ESAXException Any SAX exception.
See : IErrorHandler.warning
See : ESAXParseException

Top


procedure error(const e : ISAXParseError);

Receive notification of a recoverable parser error.

The default implementation does nothing. Application writers may override this method in a subclass to take specific actions for each error, such as inserting the message in a log file or printing it to the console.


Parameter : e The warning information encoded as an exception.
Exception : ESAXException Any SAX exception.
See : IErrorHandler.warning
See : ESAXParseException

Top


procedure fatalError(const e : ISAXParseError);

Report a fatal XML parsing error.

The default implementation throws a SAXParseException. Application writers may override this method in a subclass if they need to take specific actions for each fatal error (such as collecting all of the errors into a single report): in any case, the application must stop all regular processing when this method is invoked, since the document is no longer reliable, and the parser may no longer report parsing events.


Parameter : e The error information encoded as an exception.
Exception : ESAXException Any SAX exception.
See : IErrorHandler.fatalError
See : ESAXParseException

Top