XMLParserItf Interface CATISAXXMLReader

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.

See also:
CATISAXEntityResolver, CATISAXDTDHandler, CATISAXContentHandler, CATISAXErrorHandler, CATSAXDefaultHandler, CATISAXInputSource


Method Index


o GetContentHandler(CATISAXContentHandler_var&)
Retrieves the current content event handler.
o GetDTDHandler(CATISAXDTDHandler_var&)
Retrieves the current DTD event handler.
o GetEntityResolver(CATISAXEntityResolver_var&)
Retrieves the current entity resolver.
o GetErrorHandler(CATISAXErrorHandler_var&)
Retrieves the current error event handler.
o GetFeature(CATUnicodeString&,CATBoolean&)
Retrieves the value of a feature.
o GetProperty(CATUnicodeString&,CATBaseUnknown_var&)
Retrieves up the value of a property.
o Parse(CATUnicodeString&)
Parses an XML document from a system identifier (URI).
o Parse(CATISAXInputSource_var&)
Parses an XML document.
o SetContentHandler(CATISAXContentHandler_var&)
Allows an application to register a content event handler.
o SetDTDHandler(CATISAXDTDHandler_var&)
Allows an application to register a DTD event handler.
o SetEntityResolver(CATISAXEntityResolver_var&)
Allows an application to register a custom entity resolver.
o SetErrorHandler(CATISAXErrorHandler_var&)
Allows an application to register an error event handler.
o SetFeature(CATUnicodeString&,CATBoolean)
Sets the value of a feature.
o SetProperty(CATUnicodeString&,CATBaseUnknown_var&)
Sets the value of a property.

Methods


o GetContentHandler
public virtual HRESULT GetContentHandler(CATISAXContentHandler_var& oContentHandler) = 0
Retrieves the current content event handler.
Parameters:
oContentHandler
The content handler.
See also:
SetContentHandler, CATSAXDefaultHandler, CATISAXContentHandler
o GetDTDHandler
public virtual HRESULT GetDTDHandler(CATISAXDTDHandler_var& oDTDHandler) = 0
Retrieves the current DTD event handler.
Parameters:
oDTDHandler
The DTD handler.
See also:
SetDTDHandler, CATSAXDefaultHandler, CATISAXDTDHandler
o GetEntityResolver
public virtual HRESULT GetEntityResolver(CATISAXEntityResolver_var& oEntityResolver) = 0
Retrieves the current entity resolver.
Parameters:
oEntityResolver
The entity resolver.
See also:
SetEntityResolver, CATSAXDefaultHandler, CATISAXEntityResolver
o GetErrorHandler
public virtual HRESULT GetErrorHandler(CATISAXErrorHandler_var& oErrorHandler) = 0
Retrieves the current error event handler.
Parameters:
oErrorHandler
The error event handler.
See also:
SetErrorHandler, CATSAXDefaultHandler, CATISAXErrorHandler
o GetFeature
public virtual HRESULT GetFeature( const CATUnicodeString& iName,
CATBoolean& oFeature) = 0
Retrieves the value of a feature.

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.

Parameters:
iName
The feature name, which is a fully-qualified URI.
oFeature
The current state of the feature (TRUE or FALSE).
Errors Returned:
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.
See also:
SetFeature
o GetProperty
public virtual HRESULT GetProperty( const CATUnicodeString& iName,
CATBaseUnknown_var& oProperty) = 0
Retrieves up the value of a property.

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.

Parameters:
iName
The property name, which is a fully-qualified URI.
oProperty
The current value of the property.
Errors Returned:
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.
See also:
SetProperty
o Parse
public virtual HRESULT Parse( const CATUnicodeString& iSystemId) = 0
Parses an XML document from a system identifier (URI).

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.

Parameters:
iSystemId
The system identifier (URI).
Errors Returned:
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
See also:
Parse
o Parse
public virtual HRESULT Parse( const CATISAXInputSource_var& iInputSource) = 0
Parses an XML document.

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.

Parameters:
iInputSource
The input source for the top-level of the XML document.
Errors Returned:
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
See also:
CATISAXInputSource, SetEntityResolver, SetDTDHandler, SetContentHandler, SetErrorHandler
o SetContentHandler
public virtual HRESULT SetContentHandler( const CATISAXContentHandler_var& iContentHandler) = 0
Allows an application to register a content event handler. If the application does not register a content handler, all content events reported by the SAX parser will be silently ignored (this is the default behaviour implemented by CATSAXDefaultHandler ). Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
Parameters:
iContentHandler
The content handler.
See also:
GetContentHandler, CATSAXDefaultHandler, CATISAXContentHandler
o SetDTDHandler
public virtual HRESULT SetDTDHandler( const CATISAXDTDHandler_var& iDTDHandler) = 0
Allows an application to register a DTD event handler. If the application does not register a DTD handler, all DTD events reported by the SAX parser will be silently ignored (this is the default behaviour implemented by CATSAXDefaultHandler ). Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
Parameters:
iDTDHandler
The DTD handler.
See also:
GetDTDHandler, CATSAXDefaultHandler, CATISAXDTDHandler
o SetEntityResolver
public virtual HRESULT SetEntityResolver( const CATISAXEntityResolver_var& iEntityResolver) = 0
Allows an application to register a custom entity resolver. If the application does not register an entity resolver, the SAX reader will resolve system identifiers and open connections to entities itself (this is the default behaviour implemented in CATSAXDefaultHandler ). Applications may register a new or different entity resolver in the middle of a parse, and the SAX parser must begin using the new resolver immediately.
Parameters:
iEntityResolver
The object for resolving entities.
See also:
GetEntityResolver, CATSAXDefaultHandler, CATISAXEntityResolver
o SetErrorHandler
public virtual HRESULT SetErrorHandler( const CATISAXErrorHandler_var& iErrorHandler) = 0
Allows an application to register an error event handler. If the application does not register an error event handler, all error events reported by the SAX parser will be silently ignored, except for CATISAXErrorHandler.FatalError, which will raise a CATSAXException error (this is the default behaviour implemented by CATSAXDefaultHandler ). Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
Parameters:
iErrorHandler
The error handler.
See also:
GetErrorHandler, CATISAXErrorHandler, CATSAXDefaultHandler
o SetFeature
public virtual HRESULT SetFeature( const CATUnicodeString& iName,
CATBoolean iFeature) = 0
Sets the value of a feature.

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.

Parameters:
iName
The feature name, which is a fully-qualified URI.
oFeature
The requested state of the feature (TRUE or FALSE).
Errors Returned:
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.
See also:
SetFeature
o SetProperty
public virtual HRESULT SetProperty( const CATUnicodeString& iName,
const CATBaseUnknown_var& iProperty) = 0
Sets the value of a property.

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.

Parameters:
iName
The property name, which is a fully-qualified URI.
iProperty
The requested value for the property.
Errors Returned:
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.
See also:
GetProperty

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

Copyright © 1999-2014, Dassault Systèmes. All rights reserved.