Hi,
I would like to use xerces-C with a PowerBuilder existing application; to do
this, I created a dll  with funcionts like the following below; the problem
is that the funcion is called a lot of times, and asis it is very
inefficient, as I have to inizialize the  system and theparser at every
call.. due to powerbuilder limitations, I can pass to a dll only primitive
types, not objects..
A sample funcion follows:
extern "C" __declspec(dllexport) int __stdcall getElementByTag(char *
XMLSourceBuffer, char * tag, char * destString)
{
        try
    {
        XMLPlatformUtils::Initialize();
    }
    catch(const XMLException& toCatch) 
        {
                return -1;
        }
        static const char*  gMemBufId = "prodInfo";
    MemBufInputSource* memBufIS = new MemBufInputSource
    (
        (const XMLByte*)XMLSourceBuffer
        , strlen(XMLSourceBuffer)
        , gMemBufId
        , false
    );
DOMParser parser;
try {
        parser.parse(*memBufIS);
} catch (const XMLException& toCatch) 
{

        return -2;
}
DOM_Document  doc = parser.getDocument();

DOM_NodeList  nodeList = doc.getElementsByTagName(tag);
.......
}

Reply via email to