The API doc says:
"void XMLPlatformUtils::Initialize () [static]
Perform per-process parser initialization."

  so I assume it isn't mean to be called repeatedly.

It is also written at http://xml.apache.org/xerces-c/program.html

"Key points to remember when using the C++ DOM classes:
- Create them as local variables, or as member variables of some
other class. Never "new" a DOM object into the heap or make an
ordinary C pointer variable to one, as this will greatly confuse
the automatic memory management. "

  So that might be your problem.

  You should just create your parser like:
  DOMParser myDOMParser;
  and you don't need to delete it. If you really want two of
them with the same name, you can put them in their own code
blocks with {}.

  I thought I noticed a similar problem in my own project
without using new. It went away when I moved my call to
XMLPlatformUtils::Terminate() to where it would only occur
once. (As it happens I am happily calling XMLPlatformUtils::Initialize()
multiple times with no apparent problems. I will be making that
go away shortly.)

  Dee Jay

+-----------------------------+------------------+-----------------------+
| Founding Partner            | Software Engineer| Dee Jay Randall, B.Sc.|
| Circular Reasoning          | Accrue Software  | M.Sc. Student, CS     |
| [EMAIL PROTECTED]| www.accrue.com   | ICQ # 43551676        |
+-----------------------------+------------------+-----------------------+
What is the average rank of every song ever written? 42  -- www.launch.com


On Mon, May 07 2001 at 03:00:30P -0700, Mitchell, Raymond wrote:
> I have run into a problem attempting to initialize and terminate
> XMLPlatformUtils more than once in a single program.  The following code
> causes the error.
> 
>       XMLPlatformUtils::Initialize();
>       DOMParser *pDOMParser = new DOMParser;
>       delete pDOMParser;
>       XMLPlatformUtils::Terminate();
>       XMLPlatformUtils::Initialize();
>       pDOMParser = new DOMParser;             // Error occurs here
>       delete pDOMParser;
>       XMLPlatformUtils::Terminate();
> 
> The error message indicates that an illegal memory access has occured.  The
> stack trace indicates that the error is occuring when trying to obtain the
> XMLMutex while constructing the XMLScanner.  Here is the stack trace:
> 
>       NTDLL! 77f8aa57()
>       XMLMutex::lock() line 117 + 11 bytes
>       XMLMutexLock::XMLMutexLock(XMLMutex * const 0x007a7b50) line 135
>       XMLScanner::commonInit() line 784 + 14 bytes
>       XMLScanner::XMLScanner(XMLValidator * const 0x007a7f90) line 162
>       DOMParser::DOMParser(XMLValidator * const 0x00000000) line 123 + 41
> bytes
>       main(int 2, char * * 0x007a1870) line 182 + 46 bytes
> 
> Is it supposed to be possible to initialize and terminate the
> XMLPlatformUtils more than once in a single program, or does calling
> XMLPatformUtils::Terminate() cause future calls to
> XMLPlatformUtils::Initialize() only to appear to work?
> 
> Thanks,
> Ray
> ---------------------------------------------------------------------
> 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]

Reply via email to