Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
StdAfx.h File Reference
#include <atlbase.h>
#include <atlcom.h>
#include "XMLElement.h"
#include "XMLElementCollection.h"
#include "XMLDocument.h"

Go to the source code of this file.

Defines

#define STRICT
#define _WIN32_WINNT   0x0400
#define _ATL_APARTMENT_THREADED

Functions

HRESULT ParseExpat (const char *pBuffer, unsigned long cbBufSize, IXMLDocument *pDocument, IXMLElement **ppElement)

Variables

CComModule _Module
const CLSID CLSID_MozXMLElement
const CLSID CLSID_MozXMLDocument
const CLSID CLSID_MozXMLElementCollection
const IID LIBID_MozActiveXMLLib

Define Documentation

Definition at line 16 of file StdAfx.h.

#define _WIN32_WINNT   0x0400

Definition at line 14 of file StdAfx.h.

Definition at line 12 of file StdAfx.h.


Function Documentation

HRESULT ParseExpat ( const char *  pBuffer,
unsigned long  cbBufSize,
IXMLDocument *  pDocument,
IXMLElement **  ppElement 
)

Definition at line 38 of file ParseExpat.cpp.

{
       if (pDocument == NULL)
       {
              return E_INVALIDARG;
       }

       XML_Parser parser = XML_ParserCreate(NULL);
       HRESULT hr = S_OK;

       cParserState.spXMLDocument = pDocument;
       pDocument->get_root(&cParserState.spXMLParent);

       // Initialise the XML parser
       XML_SetUserData(parser, &cParserState);

       // Initialise the data handlers
       XML_SetElementHandler(parser, OnStartElement, OnEndElement);
       XML_SetCharacterDataHandler(parser, OnCharacterData);
       XML_SetDefaultHandler(parser, OnDefault);

       // Parse the data
       if (!XML_Parse(parser, pBuffer, cbBufSize, 1))
       {
              /* TODO Create error code
                 fprintf(stderr,
                     "%s at line %d\n",
                 XML_ErrorString(XML_GetErrorCode(parser)),
                 XML_GetCurrentLineNumber(parser));
               */
              hr = E_FAIL;
       }

       // Cleanup
       XML_ParserFree(parser);

       cParserState.spXMLRoot->QueryInterface(IID_IXMLElement, (void **) ppElement);
       cParserState.spXMLDocument.Release();
       cParserState.spXMLParent.Release();

       return S_OK;
}

Here is the call graph for this function:


Variable Documentation

CComModule _Module

Definition at line 54 of file MozillaControl.cpp.