BREW Extensions Demystified - Part IV

Please read this post for context before moving on.

We are almost there, now we need to create the supporting file mcbxml.bid and mcbxml.mif.

Creation of mcbxml.bid

#ifndef IMCBXML_BID
#define IMCBXML_BID
  #define AEECLSID_MCBXML 0x3434CD1D
#endif //IMCBXML_BID

Creation of mcbxml.mif
Launch the mif editor, go to the Extensions tab. In the Exported Classes section add the Class ID of the MCBXML i.e. 0x3434CD1D.

Congratulations, You have successfully converted the McbXML to an BREW Extension. The complete project can be downloaded here.

Now that you have successfully created your extension you might as well want to use it. To use the McbXML extension in a applicaion, include the IMcbXML.h in the applet's source file.

To create the extension, declare the necessary varibles
IMcbXML *pIMcbXML;
McbXMLElement *pRoot = NULL;
McbXMLElement *pElement = NULL;
McbXMLResults pResults;
ISHELL_CreateInstance(pIShell, AEECLSID_MCBXML,(void**)&pIMcbXML);
Once you have successfully instantiated the extension, you can call the API's
pRoot = IMCBXML_ParseXML(pIMcbXML, szXMLString,amp;pResults);
pElement = IMCBXML_FindElement(pIMcbXML, pMe->pXMLRoot,
"xml/soapenv:Envelope/soapenv:Body/Response");
IMCBXML_DeleteRoot(pIMcbXML, pRoot);
You can now extend the functionalities of the extension by adding more functions like McbCreateXMLString to the IMCBXML interface and providing the wrapper function just like IMCBXML_ParseXML function.

0 Responses to "BREW Extensions Demystified - Part IV"