You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Andreas Pfeifer <An...@jena-optronik.de> on 2005/10/18 17:01:19 UTC
Exception when calling parse from release - build
Hi there,
I'm working under win2k and VC7 using Xerces-C 2.6.0 .
I set up a new SAXParser and customized doc- and error handlers.
For parsing I pass a char* containing the filename of my XML - file as
argument to my parsers "parse" - function.
In debug-mode everything seems to work fine, but if I run my
release-build I get an access violation (0xC0000005) on the strange
address 0x0000002c. The acception rises, bevor any of my customized
handler-functions gets called.
Thanks in advance -> Andi
Re: Exception when calling parse from release - build
Posted by Axel Weiß <aw...@informatik.hu-berlin.de>.
Andreas Pfeifer wrote:
> The program I'm about to write is for conversion of an XML satellite
> data structure description into an older ASCII description of the same
> product.
Hi Andreas,
did you have a look at XSLT stylesheet processing (e.g. Xalan)? This
problem seems to belong to the typical tasks stylesheet processors have
been developed for. I'm sure, it can save you a lot of time.
Cheers,
Axel
Re: Exception when calling parse from release - build
Posted by Andreas Pfeifer <An...@jena-optronik.de>.
Hi there,
sorry for wasting your time...
I didn't set the Multithreaded-DLL (/MD) compiler switch when compiling
the library. Now everything works fine.
Thanks again for your help
-> Andi
Re: Exception when calling parse from release - build
Posted by Andreas Pfeifer <An...@jena-optronik.de>.
Hi Alberto,
thanks for your quick answer.
I usualy don't use ASSERT - macros within my code, and initialise all
variables (searched but didn't find one uninitiallised - anyhow).
The program I'm about to write is for conversion of an XML satellite
data structure description into an older ASCII description of the same
product.
The XReader - class takes over the reading in of the structure
description. For flexibility purposes there is also an external XML
conversion description, that allows you to assign conversion rules for
the tags you pass.
XReader::~XReader()
{
XMLPlatformUtils::Terminate();
}
void XReader::parse()
{
try
{
XMLPlatformUtils::Initialize();
}
catch(...)
{
// handle stuff...
}
parser = new SAXParser();
parser->setDoValidation(true);
parser->setDoNamespaces(true);
this->docHandler = new SAXEventHandler();
this->errHandler = (ErrorHandler*)docHandler;
this->parser->setDocumentHandler(docHandler);
this->parser->setErrorHandler(errHandler);
try
{
parser->parse(this->pcXmlFile);
}
catch(...)
{
// handle stuff...
}
delete parser;
delete docHandler;
return;
}
The parser for the conversion rules is initialised and called in an
instance of a XConverter class within the constructor of SAXEventhandler.
XConverter::~XConverter()
{
XMLPlatformUtils::Terminate();
}
bool XConverter::LoadConverterRules(char* DescFileName)
{
bool success = true;
this->pcXmlFile = getenv("TDE_X_TAB");
if( this->pcXmlFile == NULL ){
return false;
}
#ifdef WIN32
strcat(pcXmlFile, "\\\0");
#else
strcat(pcXmlFile, "/\0");
#endif
strcat(pcXmlFile, DescFileName);
//! Retreive the rules for conversion by parsing the converter-file
try
{
XMLPlatformUtils::Initialize();
}
catch(...)
{
// handle stuff...
}
this->parser = new SAXParser();
this->parser->setDoValidation(true);
this->parser->setDoNamespaces(true);
this->docHandler = new XConvEventHandler();
this->errHandler = (ErrorHandler*)docHandler;
this->parser->setDocumentHandler(docHandler);
this->parser->setErrorHandler(errHandler);
try
{
parser->parse(pcXmlFile);
}
catch(...)
{
// handle stuff...
}
//! try to retreive the Event-rules from the Handler
this->Events = this->docHandler->getConvData();
//! if rules-stucture is empty
if( this->Empty() )
success = false;
delete this->parser;
delete this->docHandler;
return success;
}
Loading the converter rules (Events) finishes without any noticeable
problems. But if I return to my XReader class and try to parse the
description file I get this exception.
So long -> Andi
Re: Exception when calling parse from release - build
Posted by Alberto Massari <am...@datadirect.com>.
At 09.42 19/10/2005 +0200, Andreas Pfeifer wrote:
>Oops... Sorry, for beeing so imprecise in my 1st mail. I missed to
>mention that I run the parse-function 2 times, but with different
>target files. The 1st time it passes through without an error. It
>only occurs, when I call parse again. Is there anything I missed to
>terminate or reset?
Hi Andreas,
if the same code executed twice works in debug but doesn't work in
release, you should look for either uninitialized variables (that in
debug mode are set to 0) or an ASSERT macro with some real code
inside (that is removed in release mode).
Otherwise, please post your code.
Alberto
Re: Exception when calling parse from release - build
Posted by Andreas Pfeifer <An...@jena-optronik.de>.
Oops... Sorry, for beeing so imprecise in my 1st mail. I missed to
mention that I run the parse-function 2 times, but with different target
files. The 1st time it passes through without an error. It only occurs,
when I call parse again. Is there anything I missed to terminate or reset?
Thanks in advance -> Andi
Re: Exception when calling parse from release - build
Posted by Alberto Massari <am...@datadirect.com>.
Hi Andi,
At 17.01 18/10/2005 +0200, Andreas Pfeifer wrote:
>Hi there,
>
>I'm working under win2k and VC7 using Xerces-C 2.6.0 .
>I set up a new SAXParser and customized doc- and error handlers.
>For parsing I pass a char* containing the filename of my XML - file as
>argument to my parsers "parse" - function.
>
>In debug-mode everything seems to work fine, but if I run my
>release-build I get an access violation (0xC0000005) on the strange
>address 0x0000002c. The acception rises, bevor any of my customized
>handler-functions gets called.
Have you checked if you are doing some real work inside an ASSERT macro?
Alberto