Usage: an implementation of this interface is supplied and you must use it as is. You should not reimplement it.
interface CATISAXXMLReader
Interface for reading an XML document using callbacks.
CATISAXXMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse.
All SAX interfaces are assumed to be synchronous: the CATISAXXMLReader.Parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.
public virtual HRESULT GetContentHandler( | CATISAXContentHandler_var& | oContentHandler) = 0 |
public virtual HRESULT GetDTDHandler( | CATISAXDTDHandler_var& | oDTDHandler) = 0 |
public virtual HRESULT GetEntityResolver( | CATISAXEntityResolver_var& | oEntityResolver) = 0 |
public virtual HRESULT GetErrorHandler( | CATISAXErrorHandler_var& | oErrorHandler) = 0 |
public virtual HRESULT GetFeature( | const CATUnicodeString& | iName, |
CATBoolean& | oFeature) = 0 |
The feature name is any fully-qualified URI. It is possible for an CATISAXXMLReader to recognize a feature name but to be unable to return its value.
All CATISAXXMLReader s are required to recognize the http://xml.org/sax/features/namespaces and the http://xml.org/sax/features/namespace-prefixes feature names.
Some feature values may be available only in specific contexts, such as before, during, or after a parse.
Typical usage is something like this:
CATISAXReader_var r; hr = factory->CreateReader(r); if (SUCCEEDED(hr) && (r != NULL_var)) { hr = r->SetFeature("http://xml.org/sax/features/validation", TRUE); if (FAILED(hr)) { cerr << "Cannot activate validation." << endl; } else { CATISAXContentHandler_var myContentHandler; MyContentHandler* myContentHandlerImpl = new MyContentHandler(); myContentHandler = myContentHandlerImpl; myContentHandlerImpl->Release(); myContentHandlerImpl = NULL; CATISAXErrorHandler_var myErrorHandler; MyErrorHandler* myErrorHandlerImpl = new MyErrorHandler(); myErrorHandler = myErrorHandlerImpl; myErrorHandlerImpl->Release(); myErrorHandlerImpl = NULL; r->SetContentHandler(myContentHandler); r->SetErrorHandler(myErrorHandlerImpl); hr = Parse("http://www.foo.com/mydoc.xml"); if (FAILED(hr)) { CATError *error = CATError::CATGetLastError(); if (error != NULL) { cerr << error->GetNLSMessage().CastToCharPtr() << endl; error->Release(); error = NULL; } else { cerr << "Unknown error." << endl; } } } }
Implementors are free (and encouraged) to invent their own features, using names built on their own URIs.
Error Class | Error Id | Description |
---|---|---|
CATSAXNotRecognizedException | XMLParserERR_2302 | If the CATISAXXMLReader does not recognize the feature name. |
CATSAXNotSupportedException | XMLParserERR_2303 | When the XMLReader recognizes the feature name but cannot determine its value at this time. |
public virtual HRESULT GetProperty( | const CATUnicodeString& | iName, |
CATBaseUnknown_var& | oProperty) = 0 |
The property name is any fully-qualified URI. It is possible for a CATISAXXMLReader to recognize a property name but to be unable to return its state .
CATISAXXMLReader s are not required to recognize any specific property names, though an initial core set is documented for SAX2.
Some property values may be available only in specific contexts, such as before, during, or after a parse.
Implementors are free (and encouraged) to invent their own properties, using names built on their own URIs.
Error Class | Error Id | Description |
---|---|---|
CATSAXNotRecognizedException | XMLParserERR_2300 | If the CATISAXXMLReader does not recognize the feature name. |
CATSAXNotSupportedException | XMLParserERR_2301 | When the XMLReader recognizes the feature name but cannot determine its value at this time. |
public virtual HRESULT Parse( | const CATUnicodeString& | iSystemId) = 0 |
This method is a shortcut for the common case of reading a document from a system identifier. If the system identifier is a URL, it must be fully resolved by the application before it is passed to the parser.
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | If an error (such as a not well formed XML document) occurs during parse |
CATSAXException | XMLParserERR_2001 | If an I/O error occurs during parse |
public virtual HRESULT Parse( | const CATISAXInputSource_var& | iInputSource) = 0 |
The application can use this method to instruct the SAX parser to begin parsing an XML document from any valid input source (a character stream, a byte stream, or a URI).
Applications may not invoke this method while a parse is in progress (they should create a new CATISAXXMLReader instead for each additional XML document). Once a parse is complete, an application may reuse the same reader object, possibly with a different input source.
During the parse, the CATISAXXMLReader will provide information about the XML document through the registered event handlers.
This method is synchronous: it will not return until parsing has ended. If a client application wants to terminate parsing early, it should raise an error.
Error Class | Error Id | Description |
---|---|---|
CATSAXException | XMLParserERR_2000 | If an error (such as a not well formed XML document) occurs during parse |
CATSAXException | XMLParserERR_2001 | If an I/O error occurs during parse |
public virtual HRESULT SetContentHandler( | const CATISAXContentHandler_var& | iContentHandler) = 0 |
public virtual HRESULT SetDTDHandler( | const CATISAXDTDHandler_var& | iDTDHandler) = 0 |
public virtual HRESULT SetEntityResolver( | const CATISAXEntityResolver_var& | iEntityResolver) = 0 |
public virtual HRESULT SetErrorHandler( | const CATISAXErrorHandler_var& | iErrorHandler) = 0 |
public virtual HRESULT SetFeature( | const CATUnicodeString& | iName, |
CATBoolean | iFeature) = 0 |
The feature name is any fully-qualified URI. It is possible for an CATISAXXMLReader to recognize a feature name but to be unable to set its value.
All CATISAXXMLReader s are required to support setting http://xml.org/sax/features/namespaces to TRUE and http://xml.org/sax/features/namespace-prefixes to FALSE.
Some feature values may be immutable or mutable only in specific contexts, such as before, during, or after a parse.
Error Class | Error Id | Description |
---|---|---|
CATSAXNotRecognizedException | XMLParserERR_2302 | If the CATISAXXMLReader does not recognize the feature name. |
CATSAXNotSupportedException | XMLParserERR_2303 | When the XMLReader recognizes the feature name but cannot determine its value at this time. |
public virtual HRESULT SetProperty( | const CATUnicodeString& | iName, |
const CATBaseUnknown_var& | iProperty) = 0 |
The property name is any fully-qualified URI. It is possible for a CATISAXXMLReader to recognize a property name but to be unable to return its state.
CATISAXXMLReader s are not required to recognize any specific property names, though an initial core set is documented for SAX2.
Some property values may be available only in specific contexts, such as before, during, or after a parse.
Implementors are free (and encouraged) to invent their own properties, using names built on their own URIs.
Error Class | Error Id | Description |
---|---|---|
CATSAXNotRecognizedException | XMLParserERR_2300 | If the CATISAXXMLReader does not recognize the feature name. |
CATSAXNotSupportedException | XMLParserERR_2301 | When the XMLReader recognizes the feature name but cannot determine its value at this time. |
Copyright © 1999-2014, Dassault Systèmes. All rights reserved.