All Frameworks Class Hierarchy This Framework Previous Next Indexes
System.IUnknown | +---System.IDispatch | +---System.CATBaseUnknown | +---CATSAXDefaultHandler
Usage: you can derive this class.
public class CATSAXDefaultHandler
Default base class for SAX2 event handlers.
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 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 SAX1 CATSAXHandlerBase class.
public CATSAXDefaultHandler( | ) |
public virtual ~CATSAXDefaultHandler( | ) |
public virtual HRESULT Characters( | const CATUnicodeString& | iCharacters) |
The CATISAXXMLReader will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the CATISAXLocator provides useful information.
Note that some parsers will report whitespace using the IgnorableWhiteSpace method rather than this one (validating parsers must do so).
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
CATSAXParseException | XMLParserERR_2002 | The method can raise a CATSAXParseException |
public virtual HRESULT EndDocument( | ) |
The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
CATSAXParseException | XMLParserERR_2002 | The method can raise a CATSAXParseException |
public virtual HRESULT EndElement( | const CATUnicodeString& | iURI, |
const CATUnicodeString& | iLocalName, | |
const CATUnicodeString& | iQualifiedName) |
The SAX parser will invoke this method at the end of every element in the XML document; there will be a corresponding StartElement event for every EndElement event (even when the element is empty).
For information on the names, see StartElement.
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
CATSAXParseException | XMLParserERR_2002 | The method can raise a CATSAXParseException |
public virtual HRESULT EndPrefixMapping( | const CATUnicodeString& | iPrefix) |
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
CATSAXParseException | XMLParserERR_2002 | The method can raise a CATSAXParseException |
public virtual HRESULT Error( | CATSAXParseException* | iException) |
This corresponds to the definition of "error" in section 1.2 of the W3C XML 1.0 Recommendation. For example, a validating parser would use this callback to report the violation of a validity constraint. The default behaviour is to take no action.
The SAX parser must continue to provide normal parsing events after invoking this method: it should still be possible for the application to process the document through to the end. If the application cannot do so, then the parser should report a fatal error even if the XML 1.0 recommendation does not require it to do so.
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
CATSAXParseException | XMLParserERR_2002 | The method can raise a CATSAXParseException |
public virtual HRESULT FatalError( | CATSAXParseException* | iException) |
This corresponds to the definition of "fatal error" in section 1.2 of the W3C XML 1.0 Recommendation. For example, a parser would use this callback to report the violation of a well-formedness constraint.
The application must assume that the document is unusable after the parser has invoked this method, and should continue (if at all) only for the sake of collecting addition error messages: in fact, SAX parsers are free to stop reporting any other events once this method has been invoked.
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
CATSAXParseException | XMLParserERR_2002 | The method can raise a CATSAXParseException |
public virtual HRESULT IgnorableWhiteSpace( | const CATUnicodeString& | iCharacters) |
Validating CATISAXXMLReader s must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models.
SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the CATISAXLocator provides useful information.
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
CATSAXParseException | XMLParserERR_2002 | The method can raise a CATSAXParseException |
public virtual HRESULT NotationDecl( | const CATUnicodeString& | iName, |
const CATUnicodeString& | iPublicId, | |
const CATUnicodeString& | iSystemId) |
It is up to the application to record the notation for later reference, if necessary.
At least one of publicId and systemId must be non-empty.
If a system identifier is present, and it is a URL, the SAX parser must resolve it fully before passing it to the application.
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
CATSAXParseException | XMLParserERR_2002 | The method can raise a CATSAXParseException |
public virtual HRESULT ProcessingInstruction( | const CATUnicodeString& | iTarget, |
const CATUnicodeString& | iData) |
The CATISAXXMLReader will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element.
A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
CATSAXParseException | XMLParserERR_2002 | The method can raise a CATSAXParseException |
public virtual HRESULT ResolveEntity( | const CATUnicodeString& | iPublicId, |
const CATUnicodeString& | iSystemId, | |
CATISAXInputSource_var& | oInputSource) |
The CATISAXParser will call this method before opening any external entity except the top-level document entity (including the external DTD subset, external entities referenced within the DTD, and external entities referenced within the document element): the application may request that the parser resolve the entity itself, that it use an alternative URI, or that it use an entirely different input source.
Application writers can use this method to redirect external system identifiers to secure and/or local URIs, to look up public identifiers in a catalogue, or to read an entity from a database or other input source (including, for example, a dialog box).
If the system identifier is a URL, the SAX parser must resolve it fully before reporting it to the application.
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
CATSAXIOException | XMLParserERR_2001 | If an I/O error occurs, possibly the result of creating a new CATISAXInputSource the method can raise this error. |
public virtual HRESULT SetDocumentLocator( | const CATISAXLocator_var& | iLocator) |
SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the CATISAXContentHandler interface.
The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine.
Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.
public virtual HRESULT SkippedEntity( | const CATUnicodeString& | iName) |
The CATISAXXMLReader will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
CATSAXParseException | XMLParserERR_2002 | The method can raise a CATSAXParseException |
public virtual HRESULT StartDocument( | ) |
The SAX parser will invoke this method only once, before any other methods in this interface or in CATISAXDTDHandler (except for SetDocumentLocator ).
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
CATSAXParseException | XMLParserERR_2002 | The method can raise a CATSAXParseException |
public virtual HRESULT StartElement( | const CATUnicodeString& | iURI, |
const CATUnicodeString& | iLocalName, | |
const CATUnicodeString& | iQualifiedName, | |
const CATISAXAttributes_var& | iAttributes) |
The Parser will invoke this method at the beginning of every element in the XML document; there will be a corresponding EndElement event for every StartElement event (even when the element is empty).
All of the element content will be reported, in order, before the corresponding EndElement event .t.
This event allows up to three name components for each element:
Any or all of these may be provided, depending on the values of the http://xml.org/sax/features/namespaces and the http://xml.org/sax/features/namespace-prefixes properties:
Note that the attribute list provided will contain only attributes with explicit values (specified or defaulted): #IMPLIED attributes will be omitted. The attribute list will contain attributes used for Namespace declarations (xmlns* attributes) only if the http://xml.org/sax/features/namespace-prefixes property is TRUE (it is FALSE by default, and support for a TRUE value is optional).
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
CATSAXParseException | XMLParserERR_2002 | The method can raise a CATSAXParseException |
public virtual HRESULT StartPrefixMapping( | const CATUnicodeString& | iPrefix, |
const CATUnicodeString& | iURI) |
The information from this event is not necessary for normal Namespace processing: the CATISAXXMLReader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is TRUE (the default).
There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the StartPrefixMapping / EndPrefixMapping events supply the information to the application to expand prefixes in those contexts itself, if necessary.
Note that StartPrefixMapping / EndPrefixMapping events are not guaranteed to be properly nested relative to each-other: all StartPrefixMapping events will occur before the corresponding StartElement event, and all EndPrefixMapping events will occur after the corresponding StartElement event, but their order is not otherwise guaranteed.
There should never be StartPrefixMapping / EndPrefixMapping events for the "xml" prefix, since it is predeclared and immutable.
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
CATSAXParseException | XMLParserERR_2002 | The method can raise a CATSAXParseException |
public virtual HRESULT UnparsedEntityDecl( | const CATUnicodeString& | iName, |
const CATUnicodeString& | iPublicId, | |
const CATUnicodeString& | iSystemId, | |
const CATUnicodeString& | iNotationName) |
Note that the notation name corresponds to a notation reported by the NotationDecl event. It is up to the application to record the entity for later reference, if necessary.
If the system identifier is a URL, the parser must resolve it fully before passing it to the application.
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
CATSAXParseException | XMLParserERR_2002 | The method can raise a CATSAXParseException |
public virtual HRESULT Warning( | CATSAXParseException* | iException) |
SAX parsers will use this method to report conditions that are not errors or fatal errors as defined by the XML 1.0 recommendation. The default behaviour is to take no action.
The SAX parser must continue to provide normal parsing events after invoking this method: it should still be possible for the application to process the document through to the end.
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | The method can raise a CATSAXException |
CATSAXParseException | XMLParserERR_2002 | The method can raise a CATSAXParseException |
Copyright © 2003, Dassault Systèmes. All rights reserved.