Guys,

Ive got no idea, I really need help & the deadline is looming.

Please can I have your help?

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..
> 
> 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();
>>> }
>>> 
>>> 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;
>>>         }
>>> 
>>>             //Create New Parser (SAX)
>>>         SAXParser* parser = new SAXParser();
>>> 
>>>             //File Input Validation
>>>         parser->setDoValidation(true);    
>>>         parser->setDoNamespaces(true);   
>>> 
>>>             //Create our SAX handler object and install it on the
>>> parser (Doc & Error
>>> Handler)
>>>             //Using Project as Handler
>>>             parser->setDocumentHandler(prjHandle);
>>>             parser->setErrorHandler(prjHandle);
>>> 
>>>             //Load File through Xerces
>>>             XERCES_STD_QUALIFIER ifstream xmlFileHandle;
>>>         xmlFileHandle.open(prj_filename);
>>> 
>>>             //Load Each Line From File To Array xmlFile
>>>             bool flag = true;
>>>             while (flag == true)
>>>     {
>>>         char token[1000];
>>>         //Set array to zeros
>>>         memset(token,0,sizeof(token));
>>> 
>>>             //Sequential Search
>>>             if(!(xmlFileHandle.eof())){
>>>                     xmlFileHandle.getline(token, sizeof(token));
>>> 
>>>                     //Check If Line Contains Anything
>>>                     if(!(token))
>>>                             continue;
>>>                     else {
>>>                             //Load into New Derived Variable for
>>> overloading & Safety
>>>                             const char *XMLfile = token;
>>> 
>>>                             //Debug
>>>                             cout << "Parsing: " << XMLfile << endl;
>>> 
>>>                             //ERROR WIPE -> NEEDS IMPLIMENTING
>>> 
>>>                             try {
>>>                                     parser->parse(XMLfile);
>>>                             }
>>>                             catch(XMLException &e){
>>>                                     cout << "ERROR OCCURED" << endl;
>>>                             }
>>> 
>>>                     }
>>>                     
>>>             
>>>             }
>>>             //ELSE STATEMENT FOR EOF-> Set Flag to false therefore
>>> exiting while loop
>>>             else
>>>                     flag = false;
>>> 
>>> 
>>>     }
>>>             return true;
>>> }
>>> 
>>> Thanks For looking at this its been bugging me for hours
>>> 
>>> Cheers
>>> -Alex
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/Error-In-Code-%28Sax-Parsing%29-tf2860959.html#a79
>>> 93779
>>> Sent from the Xerces - C - Users mailing list archive at Nabble.com.
>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Error-In-Code-%28Sax-Parsing%29-tf2860959.html#a8000110
Sent from the Xerces - C - Users mailing list archive at Nabble.com.

Reply via email to