What exactly is the question really? The limitations you describe are part
of the product you've chosen, so we can't help you there. And you don't say
what you do with the parsed data once you've parsed it.

You could avoid multiple initialization calls, but that won't gain you much
since that call is already checking for multiple init anyway and not doing
anything if its already initialized (assuming you are using some reasonably
recent version.)

You could certainly maintain a 'pool' of parsers at static file scope
within the DLL and just ask for one from that pool to use for the duration
of each call, then give it back to the pool. That would avoid the overhead
of creating parsers on each call.

----------------------------------------
Dean Roddey
Software Weenie
IBM Center for Java Technology - Silicon Valley
[EMAIL PROTECTED]



Davanzo Luca <[EMAIL PROTECTED]> on 02/22/2000 05:01:22 AM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:
Subject:  A more efficent way..



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