|
|
Home | Loader API | Interfaces | File List | Index | |
This is the main SAX interface. More...
#include <p6sax2xmlreader.h>
Inherits P6R::p6ICom.
Public Member Functions | |
virtual P6R::P6INT32 | addref ()=0 |
This method increases the reference count of the component instance by one. | |
virtual P6R::P6ERR | getContentHandler (p6ISAX2ContentHandler **pObject)=0 |
The content handler component is defined and set by the application. | |
virtual P6R::P6ERR | getDTDHandler (p6ISAX2DTDHandler **pObject)=0 |
The DTD handler component is defined and set by the application. | |
virtual P6R::P6ERR | getEntityResolver (p6ISAX2EntityResolver **pObject)=0 |
The Entity handler component is defined and set by the application. | |
virtual P6R::P6ERR | getErrorHandler (p6ISAX2ErrorHandler **pObject)=0 |
The Error handler component is defined and set by the application. | |
virtual P6R::P6ERR | getFeature (const P6CHAR *pString, P6BOOL *pResult)=0 |
Test to see if a feature has been enabled. | |
virtual P6R::P6ERR | getProperty (const P6CHAR *pString, P6VOID **pObject)=0 |
Properties are not currently supported. | |
virtual P6R::P6ERR | initialize (P6SAX2FLAGS flags)=0 |
Sets up the component to run properly. | |
virtual P6R::P6ERR | queryInterface (const P6R::IID &iid, P6R::P6VOID **ppIface)=0 |
This method queries the component for a specific interface. | |
virtual P6R::P6INT32 | release ()=0 |
This method decrements a components reference count. | |
virtual P6R::P6ERR | releaseAllHandlers ()=0 |
This is not a standard SAX2 function. | |
virtual P6R::P6ERR | setContentHandler (p6ISAX2ContentHandler *pObject)=0 |
The calling application uses this method to register a content handler. | |
virtual P6R::P6ERR | setDTDHandler (p6ISAX2DTDHandler *pObject)=0 |
The calling application uses this method to register a DTD event handler. | |
virtual P6R::P6ERR | setEntityResolver (p6ISAX2EntityResolver *pObject)=0 |
The calling application uses this method to register an application written (or custom) entity resolver. | |
virtual P6R::P6ERR | setErrorHandler (p6ISAX2ErrorHandler *pObject)=0 |
The calling application uses this method to register an error event hanlder. | |
virtual P6R::P6ERR | setFeature (const P6CHAR *pString, P6BOOL result)=0 |
Features: http://xml.org/sax/features/namespaces and http://xml.org/sax/features/namespaces-prefixes. | |
virtual P6R::P6ERR | setProperty (const P6CHAR *pString, P6VOID *pObject)=0 |
Properties are not currently supported. |
This is the main SAX interface.
Notice that there is no separate parse function. That is because this component implements the p6IDataStream interface (see p6datastream.h). Thus this component supports the parsing of a stream of XML data.
To parse either a single buffer or a stream of XML buffers perform the following steps:
First get an XML reader object: p6ISAX2XMLReader *pReader; P6ERR err = p6CreateInstance( NULL, CID_p6SAX2XMLReader, VALIDATEIF( p6ISAX2XMLReader, &pReader )); Then using the XML reader, get the p6IDataStream interface on that component: p6IDataStream *pStream; err = pReader->queryInterface( VALIDATEIF( p6IDataStream, &pStream )); Initialize the data stream interface: err = pStream->beginStream(); Pass the buffer(s) to be parsed one at a time: err = pStream->processStream( buffer, bufSize ); // -> 1st buffer of stream . . . . . . err = pStream->processStream( buffer, bufSize ); // -> nth buffer of stream The input 'buffer' to the processStream() method is where the P6SAX2STRING pointers will often point to. The processStream() function can return an "eEndOfFile" error code to indicate that it is done with the buffer provided and that the buffer is incomplete (i.e., the XML top most element has not yet been closed). Close the stream down: err = pStream->endStream(); pStream->release();
For the setFeature() method the following features are supported:
(1) http://xml.org/sax/features/namespaces (defaults to false), namespace names always returned even if this is set to false, p6ISAX2ContentHandler::startPrefixMapping and p6ISAX2ContentHandler::endPrefixMapping called if set to true.
(2) http://xml.org/sax/features/namespaces-prefixes (defaults to false), qualified names (qNames) are always returned even if this is set to false, attribues with names beginning with 'xmlns' are not suppressed, i.e., returned to applicaiton just like all other attributes.
Definition at line 89 of file p6sax2xmlreader.h.