appleGuy wrote:
Guys,
Ive got no idea, I really need help & the deadline is looming.
Please can I have your help?
Yes, but relying on the list to conform to your deadline is probably not a
good idea, because people may or may not have time to respond.
Cheers
Alex
appleGuy wrote:
Hi,
Ok...I think ive found the problem. Its to do with memory!
On debugging it seems to break on:
void* MemoryManagerImpl::allocate(size_t size)
{
void* memptr;
try {
memptr = ::operator new(size);
My debugger breaks ar memptr..
Does it break at the definition of memptr, or the call to ::operator new()?
What is the call stack?
Hmm...Ive honestly got no idea how to fix this
-Alex
appleGuy wrote:
Ok, Ill see what turns up.
Most (if not all) of the parsing code is not in the constructor. Its in a
seperate function, that is independant of the constructor.
Cheers
Alex
Jesse Pelton wrote:
You might want to start by trapping all the exceptions that parse() can
generate. DOMException, OutOfMemoryException, and (I think)
SAXException are all possibilities that you haven't covered. Using the
getMessage() member to display the exception message may well be
revealing.
Personally, I'd think twice before implementing a constructor that does
so much work. Handling exceptions properly in constructors is
notoriously difficult, and this one is rife with opportunities for
error.
-----Original Message-----
From: appleGuy [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 20, 2006 12:05 PM
To: [email protected]
Subject: Error In Code (Sax Parsing)
Hi,
My program generates a runtime error...I went through the debugger & it
seems to break at the parser->parse(XMLfile)
The error is:
Debug Error!....this application has requested the runtime to terminate
in
an unusual way
The code with problems:
#include "prjLoad.h"
//DEBUG
#include <iostream>
using namespace std;
//Default Constructor
prjLoad::prjLoad(prjHandler *ptr_tmp): prjHandle(ptr_tmp){
loadXML_prj("xml_file.xml");
}
//Destructor
prjLoad::~prjLoad(void){
//Terminate The Dom Session
XMLPlatformUtils::Terminate();
}
The use of void in the parameter list of your constructor is an anachronism
left over from C code, and is not necessary.
Note that if you construct an instance of your object, then neglect to call
prjLoad::loadXML_prj(), then you cannot call XMLPlatformUtils::Terminate()
in the constructor. It would be better if you called initialization in
your constructor. Or, better yet, if you called
XMLPlatformUtils::Initialize() _once_ when your executable starts, and
XMLPlatformUtils::Terminate() _once_ when your executable exits.
bool prjLoad::loadXML_prj(char *prj_filename){
//Start XML Xerces Framework
try {
XMLPlatformUtils::Initialize();
}
catch (const XMLException& toCatch) {
char* message = XMLString::transcode(toCatch.getMessage());
cout << "Error during initialization! :\n"
<< message << "\n";
XMLString::release(&message);
return false;
}
Calling XMLString::transcode() when XMLPlatformUtils::Initialize() fails
will not work. You cannot call any Xerces-C APIs if initialization fails.
Dave