Did you even try to compile this code? This is a Xerces-C mailing list,
not a C++ language mailing list!
Either:
const size_t XMLparserpoolsize = 10;
DOMParser arrayDOM[XMLparserpoolsize];
or:
const size_t XMLparserpoolsize = 10;
DOMParser* arrayDOM[XMLparserpoolsize];
for (size_t idx=0;idx< XMLparserpoolsize ; idx++)
{
arrayDOM[idx] = new DOMParser;
}
for (size_t idx=0;idx< XMLparserpoolsize ; idx++)
{
delete arrayDOM[idx];
}
or:
size_t XMLparserpoolsize = 10;
DOMParser* arrayDOM = new DOMParser[XMLparserpoolsize];
delete [] arrayDOM;
or:
size_t XMLparserpoolsize = 10;
DOMParser** arrayDOM = new DOMParser*[XMLparserpoolsize];
for (size_t idx=0;idx< XMLparserpoolsize ; idx++)
{
arrayDOM[idx] = new DOMParser;
}
for (size_t idx=0;idx< XMLparserpoolsize ; idx++)
{
delete arrayDOM[idx];
}
delete [] arrayDOM;
could work, but your code will not.
One might be better than the others, depending on the usage scenario.
Dave
"Awasthi,
Anand" To: "'[EMAIL PROTECTED]'"
<[EMAIL PROTECTED]>
<Anand_Awasth cc: (bcc: David N Bertoni/CAM/Lotus)
[EMAIL PROTECTED]> Subject: example of DOM parser instance
pool
06/01/2001
04:24 PM
Please
respond to
xerces-c-dev
hi,
I want to create a pool of DOM Parser instances in my program and later use
that pool for handling councurrent parsing requests.
i wrote following lines :
DOMParser arrayDOM[XMLparserpoolsize];
for (int idx=0;idx< XMLparserpoolsize ; idx++)
{
arrayDOM[idx] = new DOMParser();
}
is the above code correct ??
please tell me if there is a better way to create Parser instance pool in
C++ ??
thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]