All Frameworks Class Hierarchy This Framework Previous Next Indexes
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.
public virtual HRESULT Comment( | const CATUnicodeString& | iComment) = 0 |
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).
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
public virtual HRESULT EndCDATA( | )= 0 |
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
public virtual HRESULT EndDTD( | )= 0 |
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.
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
public virtual HRESULT EndEntity( | const CATUnicodeString& | iName) = 0 |
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
public virtual HRESULT StartCDATA( | )= 0 |
The contents of the CDATA section will be reported through the regular CATISAXContentHandler.Characters event; this event is intended only to report the boundary.
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
public virtual HRESULT StartDTD( | const CATUnicodeString& | iName, |
const CATUnicodeString& | iPublicId, | |
const CATUnicodeString& | iSystemId) = 0 |
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.
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
public virtual HRESULT StartEntity( | const CATUnicodeString& | iName) = 0 |
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.
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
Copyright © 2003, Dassault Systèmes. All rights reserved.