The DOM_Node instance _must_ be out of scope before you call XMLPlatformUtils::Terminate():
{
� DOM_Node doc = parser->getDocument();
...
��}
�
//clean up
� delete parser;
� XMLPlatformUtils::Terminate();
Dave
"Lang, Jeff" <[EMAIL PROTECTED]>
01/18/2002 12:46 PM | To: <[EMAIL PROTECTED]> cc: Subject: Core Dump after instantiating a DOM_Node |
I am running Xerces C++ 1.6.0 on Solaris.� I compiled with g++.
I am trying to get my own programs to compile, but�when I try parsing a file, and then putting it into a DOM_Node I get an error when the destructor is called on that DOM_Node.
�
for example:
�
#include <iostream>
#include <string>
#include <util/PlatformUtils.hpp>
#include <framework/StdInInputSource.hpp>
#include <parsers/DOMParser.hpp>
#include <dom/DOM_DOMException.hpp>
#include <framework/MemBufInputSource.hpp>
#include <util/XMLString.hpp>
#include <dom/DOM_Node.hpp>
��������
int main(int argc, char* argv[]){
� try{
��� XMLPlatformUtils::Initialize();
� }
� catch (const XMLException& toCatch){
��� cerr << "Error during initialization! :\n"
�������� << XMLString::transcode(toCatch.getMessage()) << endl;
��� return 1;
� }
�
� // Instantiate the DOM parser.
� DOMParser * parser = new DOMParser;
��
� char *XMLcode="<testdata>this is only a test</testdata>";
� StdInInputSource source;
�
� try{
��� parser->parse(source);
�
� catch (const XMLException& toCatch){
��� cerr << "\nError during parsing\n"
�������� << "Exception message is:� \n"
�������� << XMLString::transcode(toCatch.getMessage()) << "\n" << endl;
��� return 1;
� }
� catch (const DOM_DOMException& toCatch){
��� cerr << "\nDOM Error during parsing\n"
�������� << "DOMException code is:� \n"
�������� << toCatch.code << "\n" << endl;
��� return 1;
�
� catch (...){
��� cerr << "\nUnexpected exception during parsing\n";
��� return 1;
� }
�
� DOM_Node doc = parser->getDocument();
��
� //clean up
� delete parser;
��������
� XMLPlatformUtils::Terminate();
� cout<<"Core Dump comes after this point"<<endl;
���
� return 0;
}��
�
�
If i were to comment out the line instanciating the DOM_Node this will run without any problems.
Any ideas what it might be?
�
Thanks in advance,
Jeff Lang
