All Frameworks  Class Hierarchy  This Framework  Previous  Next  Indexes

XMLParser Interface CATISAXLexicalHandler

System.IUnknown
  |
  +---System.IDispatch
    |
    +---System.CATBaseUnknown
      |
      +---CATISAXLexicalHandler
 

Usage: you can freely reimplement this interface.


interface CATISAXLexicalHandler

Interface to receive notification of lexical events.

This is an optional extension handler for SAX2 to provide lexical information about an XML document, such as comments and CDATA section boundaries; XML readers are not required to support this handler, and it is not part of the core SAX2 distribution.

The events in the lexical handler apply to the entire document, not just to the document element, and all lexical handler events must appear between the content handler's CATISAXContentHandler.StartDocument and CATISAXContentHandler.EndDocument events.

To set the CATISAXDeclHandler for an CATISAXXMLReader, use the CATISAXXMLReader.SetProperty method with the propertyId "http://xml.org/sax/properties/lexical-handler". If the reader does not support declaration events, it will return a CATSAXNotRecognizedException error or a CATSAXNotSupportedException error when you attempt to register the handler.

See also:
CATISAXXMLReader


Method Index


o Comment(CATUnicodeString&)
Receives notification of an XML comment anywhere in the document.
o EndCDATA()
Receives notification of the end of a CDATA section.
o EndDTD()
Receives notification of the end of DTD declarations.
o EndEntity(CATUnicodeString&)
Receives notification of the end of an entity.
o StartCDATA()
Receives notification of the start of a CDATA section.
o StartDTD(CATUnicodeString&,CATUnicodeString&,CATUnicodeString&)
Receives notification of the start of DTD declarations, if any.
o StartEntity(CATUnicodeString&)
Receives notification of the beginning of some internal and external XML entities.

Methods


o Comment
public virtual HRESULT Comment( const CATUnicodeString& iComment) = 0
Receives notification of an XML comment anywhere in the document.

This callback will be used for comments inside or outside the document element, including comments in the external DTD subset (if read). Comments in the DTD must be properly nested inside StartDTD / EndDTD and StartEntity / EndEntity events (if used).

Parameters:
iComment
The comment text.
Errors Returned:
Error Class Error Id Description
CATSAXException XMLParserERR_2000 The method can raise a CATSAXException
See also:
StartCDATA
o EndCDATA
public virtual HRESULT EndCDATA()= 0
Receives notification of the end of a CDATA section.
Errors Returned:
Error Class Error Id Description
CATSAXException XMLParserERR_2000 The method can raise a CATSAXException
See also:
StartCDATA
o EndDTD
public virtual HRESULT EndDTD()= 0
Receives notification of the end of DTD declarations.

This method is intended to report the end of the DOCTYPE declaration; if the document has no DOCTYPE declaration, this method will not be invoked.

Errors Returned:
Error Class Error Id Description
CATSAXException XMLParserERR_2000 The method can raise a CATSAXException
See also:
StartDTD
o EndEntity
public virtual HRESULT EndEntity( const CATUnicodeString& iName) = 0
Receives notification of the end of an entity.
Errors Returned:
Error Class Error Id Description
CATSAXException XMLParserERR_2000 The method can raise a CATSAXException
Parameters:
iName
The name of the entity that is ending.
See also:
StartEntity
o StartCDATA
public virtual HRESULT StartCDATA()= 0
Receives notification of the start of a CDATA section.

The contents of the CDATA section will be reported through the regular CATISAXContentHandler.Characters event; this event is intended only to report the boundary.

Errors Returned:
Error Class Error Id Description
CATSAXException XMLParserERR_2000 The method can raise a CATSAXException
See also:
EndCDATA
o StartDTD
public virtual HRESULT StartDTD( const CATUnicodeString& iName,
const CATUnicodeString& iPublicId,
const CATUnicodeString& iSystemId) = 0
Receives notification of the start of DTD declarations, if any.

This method is intended to report the beginning of the DOCTYPE declaration; if the document has no DOCTYPE declaration, this method will not be invoked.

All declarations reported through CATISAXDTDHandler or CATISAXDeclHandler events must appear between the StartDTD and EndDTD events. Declarations are assumed to belong to the internal DTD subset unless they appear between StartEntity and EndEntity events. Comments and processing instructions from the DTD should also be reported between the StartDTD and EndDTD events, in their original order of (logical) occurrence; they are not required to appear in their correct locations relative to CATISAXDTDHandler or CATISAXDeclHandler events, however.

Note that the StartDTD / EndDTD events will appear within the CATISAXContentHandler.StartDocument / CATISAXContentHandler.EndDocument events and before the first CATISAXContentHandler.StartElement event.

Parameters:
iName
The document type name.
iPublicId
The declared public identifier for the external DTD subset, or an empty string if none was declared.
iSystemId
The declared system identifier for the external DTD subset, or an empty string if none was declared.
Errors Returned:
Error Class Error Id Description
CATSAXException XMLParserERR_2000 The method can raise a CATSAXException
See also:
EndDTD
o StartEntity
public virtual HRESULT StartEntity( const CATUnicodeString& iName) = 0
Receives notification of the beginning of some internal and external XML entities.

The reporting of parameter entities (including the external DTD subset) is optional, and SAX2 drivers that support CATISAXLexicalHandler may not support it; you can use the http://xml.org/sax/features/lexical-handler/parameter-entities feature to query or control the reporting of parameter entities.

General entities are reported with their regular names, parameter entities have '%' prepended to their names, and the external DTD subset has the pseudo-entity name "[dtd]".

When a SAX2 driver is providing these events, all other events must be properly nested within StartEntity / EndEntity events. There is no additional requirement that events from CATISAXDeclHandler or CATISAXDTDHandler be properly ordered.

Note that skipped entities will be reported through the CATISAXContentHandler.SkippedEntity event, which is part of the CATISAXContentHandler interface.

Because of the streaming event model that SAX uses, some entity boundaries cannot be reported under any circumstances:

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 StartEntity / EndEntity events must be properly nested.

Parameters:
iName
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]".
Errors Returned:
Error Class Error Id Description
CATSAXException XMLParserERR_2000 The method can raise a CATSAXException
See also:
EndEntity, CATISAXDeclHandler.InternalEntityDecl, CATISAXDeclHandler.ExternalEntityDecl

This object is included in the file: CATISAXLexicalHandler.h
If needed, your Imakefile.mk should include the module: CATXMLParserItf

Copyright © 2003, Dassault Systèmes. All rights reserved.