Class Summary : TDefaultHandler2
This class extends the SAX2 base handler class to support the
SAX2 ILexicalHandler,
IDeclHandler, 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
IContentHandler.setDocumentLocator() call might be passed a
ILocator2 object, and that the
IContentHandler.startElement() call might be passed a
IAttributes2 object.
Since : SAX 2.0 (extensions 1.1 alpha)
Methods
procedure
elementDecl(SAXString, SAXString)
procedure
attributeDecl(SAXString, SAXString, SAXString, SAXString, SAXString)
procedure
internalEntityDecl(SAXString, SAXString)
procedure
externalEntityDecl(SAXString, SAXString, SAXString)
procedure
startDTD(SAXString, SAXString, SAXString)
procedure
endDTD()
procedure
startEntity(SAXString)
procedure
endEntity(SAXString)
procedure
startCDATA()
procedure
endCDATA()
procedure
comment(SAXString)
function
getExternalSubset(SAXString, SAXString) : IInputSource
function
resolveEntity(SAXString, SAXString, SAXString, SAXString) : IInputSource
function
resolveEntity(SAXString, SAXString) : IInputSource
procedure elementDecl(const name : SAXString; const model : SAXString);
Report an element type declaration.
Parameter : name The element type name.
Parameter : model The content model as a normalized string.
Exception : ESAXException The application may raise an exception.
/
Top
procedure attributeDecl(const eName : SAXString; const aName : SAXString; const attrType : SAXString; const mode : SAXString; const value : SAXString);
Report an attribute type declaration.
Parameter : eName The name of the associated element.
Parameter : aName The name of the attribute.
Parameter : attrType A string representing the attribute type.
Parameter : mode A string representing the attribute defaulting mode
("#IMPLIED", "#REQUIRED", or "#FIXED") or '' if
none of these applies.
Parameter : value A string representing the attribute's default value,
or '' if there is none.
Exception : ESAXException The application may raise an exception.
Top
procedure internalEntityDecl(const name : SAXString; const value : SAXString);
Report an internal entity declaration.
Parameter : name The name of the entity. If it is a parameter
entity, the name will begin with '%'.
Parameter : value The replacement text of the entity.
Exception : ESAXException The application may raise an exception.
See : TDefaultHandler2.externalEntityDecl
See : IDTDHandler.unparsedEntityDecl
Top
procedure externalEntityDecl(const name : SAXString; const publicId : SAXString; const systemId : SAXString);
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 : publicId The declared public identifier of the entity, or
an empty string if none was declared.
Parameter : systemId The declared system identifier of the entity.
Exception : ESAXException The application may raise an exception.
See : TDefaultHandler2.internalEntityDecl
See : IDTDHandler.unparsedEntityDecl
Top
procedure startDTD(const name : SAXString; const publicId : SAXString; const systemId : SAXString);
Report the start of DTD declarations, if any.
Parameter : name The document type name.
Parameter : publicId The declared public identifier for the
external DTD subset, or an empty string if none was declared.
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.)
Exception : ESAXException The application may raise an
exception.
See : TDefaultHandler2.endDTD
See : TDefaultHandler2.startEntity
Top
procedure endDTD();
Report the end of DTD declarations.
Exception : ESAXException The application may raise an exception.
See : TDefaultHandler2.startDTD
Top
procedure startEntity(const name : SAXString);
Report the beginning of some internal and external XML entities.
- general entities within attribute values
- parameter entities within declarations
These will be silently expanded, with no indication of where
the original entity boundaries were.
Note also that the boundaries of character references (which
are not really entities anyway) are not reported.
All start/endEntity events must be properly nested.
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]".
Exception : SAXException The application may raise an exception.
See : TDefaultHandler2.endEntity
See : IDeclHandler.internalEntityDecl
See : IDeclHandler.externalEntityDecl
Top
procedure endEntity(const name : SAXString);
Report the end of an entity.
Parameter : name The name of the entity that is ending.
Exception : ESAXException The application may raise an exception.
See : TDefaultHandler2.startEntity
Top
procedure startCDATA();
Report the start of a CDATA section.
Exception : ESAXException The application may raise an exception.
See : TDefaultHandler2.endCDATA
Top
procedure endCDATA();
Report the end of a CDATA section.
Exception : ESAXException The application may raise an exception.
See : TDefaultHandler2.startCDATA
Top
procedure comment(const ch : SAXString);
Report an XML comment anywhere in the document.
Parameter : ch The characters in the comment.
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
TDefaultHandler.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