Class Summary : TBufferedDefaultHandler2

This class extends the SAX2 base buffered handler class to support the SAX2
IBufferedLexicalHandler, IBufferedDeclHandler, and IEntityResolver2 extensions. Except for overriding the original SAX1 resolveEntity method the added handler methods just return. Subclassers may override everything on a method-by-method basis.
This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY.

Note: this class might yet learn that the IBufferedContentHandler.setDocumentLocator() call might be passed a IBufferedLocator2 object, and that the IBufferedContentHandler.startElement() call might be passed a IBufferedAttributes2 object.

For reasons of generality and efficiency, strings that are returned from the interface are declared as pointers (PSAXChar) and lengths. This requires that the model use procedural out parameters rather than functions as in the original interfaces.


Since : SAX 2.0 (extensions 1.1 alpha)

Methods

procedure elementDecl(PSAXChar, Integer, PSAXChar, Integer)
procedure attributeDecl(PSAXChar, Integer, PSAXChar, Integer, PSAXChar, Integer, PSAXChar, Integer, PSAXChar, Integer)
procedure internalEntityDecl(PSAXChar, Integer, PSAXChar, Integer)
procedure externalEntityDecl(PSAXChar, Integer, PSAXChar, Integer, PSAXChar, Integer)
procedure startDTD(PSAXChar, Integer, PSAXChar, Integer, PSAXChar, Integer)
procedure endDTD()
procedure startEntity(PSAXChar, Integer)
procedure endEntity(PSAXChar, Integer)
procedure startCDATA()
procedure endCDATA()
procedure comment(PSAXChar, Integer)
function getExternalSubset(SAXString, SAXString) : IInputSource
function resolveEntity(SAXString, SAXString, SAXString, SAXString) : IInputSource
function resolveEntity(SAXString, SAXString) : IInputSource


procedure elementDecl( name : PSAXChar; nameLength : Integer; model : PSAXChar; modelLength : Integer);

Report an element type declaration.

The content model will consist of the string "EMPTY", the string "ANY", or a parenthesised group, optionally followed by an occurrence indicator. The model will be normalized so that all parameter entities are fully resolved and all whitespace is removed,and will include the enclosing parentheses. Other normalization (such as removing redundant parentheses or simplifying occurrence indicators) is at the discretion of the parser.


Parameter : name The element type 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 : model The content model as a normalized string.
Parameter : modelLength The length of the model 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 application may raise an exception. /

Top


procedure attributeDecl( eName : PSAXChar; eNameLength : Integer; aName : PSAXChar; aNameLength : Integer; attrType : PSAXChar; attrTypeLength : Integer; mode : PSAXChar; modeLength : Integer; value : PSAXChar; valueLength : Integer);

Report an attribute type declaration.

Only the effective (first) declaration for an attribute will be reported. The type will be one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", a parenthesized token group with the separator "|" and all whitespace removed, or the word "NOTATION" followed by a space followed by a parenthesized token group with all whitespace removed.

The value will be the value as reported to applications, appropriately normalized and with entity and character references expanded.


Parameter : eName The name of the associated element.
Parameter : eNameLength The length of the eName 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 : aName The name of the attribute.
Parameter : aNameLength The length of the aName 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 : attrType A string representing the attribute type.
Parameter : attrTypeLength The length of the attrType 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 : mode A string representing the attribute defaulting mode ("#IMPLIED", "#REQUIRED", or "#FIXED") or '' if none of these applies.
Parameter : modeLength The length of the mode 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 : value A string representing the attribute's default value, or an empty string if there is none.
Parameter : valueLength The length of the value 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 application may raise an exception.

Top


procedure internalEntityDecl( name : PSAXChar; nameLength : Integer; value : PSAXChar; valueLength : Integer);

Report an internal entity declaration.
Parameter : name The name of the entity. If it is a parameter entity, the name will begin with '%'.
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 : value The replacement text of the entity.
Parameter : valueLength The length of the value 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 application may raise an exception.
See : TBufferedDefaultHandler2.externalEntityDecl
See : IBufferedDTDHandler.unparsedEntityDecl

Top


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

Report a parsed external entity declaration.
Parameter : name The name of the entity. If it is a parameter entity, the name will begin with '%'.
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 declared public identifier of the entity, or the empty string if none was declared.
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 declared system identifier of the entity.
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 The application may raise an exception.
See : TBufferedDefaultHandler2.internalEntityDecl
See : IBufferedDTDHandler.unparsedEntityDecl

Top


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

Report the start of DTD declarations, if any.
Parameter : name The document type 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 declared public identifier for the external DTD subset, or an empty string if none was declared.
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 declared system identifier for the external DTD subset, or an empty string if none was declared. (Note that this is not resolved against the document base URI.)
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 The application may raise an exception.
See : TBufferedDefaultHandler2.endDTD
See : TBufferedDefaultHandler2.startEntity

Top


procedure endDTD();

Report the end of DTD declarations.
Exception : ESAXException The application may raise an exception.
See : TBufferedDefaultHandler2.startDTD

Top


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

Report the beginning of some internal and external XML entities.
Parameter : name The name of the entity. If it is a parameter entity, the name will begin with '%', and if it is the external DTD subset, it will be '[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 : SAXException The application may raise an exception.
See : TBufferedDefaultHandler2.endEntity
See : IBufferedDeclHandler.internalEntityDecl
See : IBufferedDeclHandler.externalEntityDecl /

Top


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

Report the end of an entity.
Parameter : name The name of the entity that is ending.
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 The application may raise an exception.
See : TBufferedDefaultHandler2.startEntity

Top


procedure startCDATA();

Report the start of a CDATA section.
Exception : ESAXException The application may raise an exception.
See : TBufferedDefaultHandler2.endCDATA

Top


procedure endCDATA();

Report the end of a CDATA section.
Exception : ESAXException The application may raise an exception.
See : TBufferedDefaultHandler2.startCDATA

Top


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

Report an XML comment anywhere in the document.
Parameter : ch An array holding the characters in the comment.
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 The application may raise an exception.

Top


function getExternalSubset(const name : SAXString; const baseURI : SAXString) : IInputSource;

Allows applications to provide an external subset for documents that don't explicitly define one.
Parameter : name Identifies the document root element. This name comes from a DOCTYPE declaration (where available) or from the actual root element.
Parameter : baseURI The document's base URI, serving as an additional hint for selecting the external subset. This is always an absolute URI, unless it is an empty string because the IXMLReader was given an IInputSource without one.
Result : An InputSource object describing the new external subset to be used by the parser, or nil to indicate that no external subset is provided.
Exception : ESAXException Any SAX exception.

Top


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

Tells the parser to resolve the systemId against the baseURI and read the entity text from that resulting absolute URI. Note that because the older TBufferedDefaultHandler.resolveEntity method is overridden to call this one, this method may sometimes be invoked with null name and baseURI, and with the systemId already absolutized.
Parameter : name Identifies the external entity being resolved. Either '[dtd]' for the external subset, or a name starting with '%' to indicate a parameter entity, or else the name of a general entity.
Parameter : publicId The public identifier of the external entity being referenced (normalized as required by the XML specification), or an empty string if none was supplied.
Parameter : baseURI The URI with respect to which relative systemIDs are interpreted. This is always an absolute URI, unless it is nil because the XMLReader was given an IInputSource without one. This URI is defined by the XML specification to be the one associated with the '<' starting the relevant declaration.
Parameter : systemId The system identifier of the external entity being referenced; either a relative or absolute URI.
Result : An IInputSource object describing the new input source to be used by the parser. Returning nil directs the parser to resolve the system ID against the base URI and open a connection to resulting URI.
Exception : ESAXException Any SAX exception.

Top


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

Invokes IEntityResolver2.resolveEntity with empty entity name and base URI. You only need to override that method to use this class.

Top