Hi all,

Below is a method from a class that I am calling to parse a file and assign
a DOM document after it has been parsed.

The program has started to crash at the point identified below as "// fails
HERE!!!!!"
I have tried this with both v1.5 and 1.6 XERCES Distributions.

Any suggestions are welcome....

This code did work at one stage... unfortunately I made so many changes to
other bits I can no longer remember or figure out what broke it.


Sid Young
QML Pathology
Brisbane




/**
 *  makeDocument()
 *
 *
 *  Creates a DOM document from the file given.
 *
 *
 *
 *  @PRE    - DataFile is valid XML
 *  @POST   - DOM document created and stored.
 *  @RETURN - boolean - True parse OK
 */
bool SAXHandler::makeDocument(CDataFile *pDF)
{
DOM_Document domDocument;       // normall in class definition under
"private:"

        pLog->log_function("makeDocument()");

        DOMParser::ValSchemes valScheme = DOMParser::Val_Never;
        pLog->log("create DOM parser");
        DOMParser *parser = new DOMParser();
        pLog->log("setup DOM parameters");
        parser->setValidationScheme(valScheme);
        parser->setDoNamespaces(false);
        parser->setDoSchema(false);
        char tmpBuff[1024];
        strcpy(tmpBuff, pDF->getFullFilePath().c_str());
        pLog->log("DOM Parse %s", tmpBuff);
        pLog->log("DOM Parse begin");
/*
 * Parse the document
 */
        try
        {
                pLog->log("DOM Parse %s", (char*)tmpBuff);
                parser->resetErrors();
                parser->parse( (char*)pDF->getFullFilePath().c_str() );
        }
        catch (const XMLException &e)
        {
                cout<<"Exception during XML processing -
"<<e.getMessage()<<endl<<endl;
                return false;
        }
        pLog->log("Parser completed");

// fails HERE!!!!!
        try
        {
                pLog->log("Try to assign DOM document");
                domDocument = parser->getDocument();
        }
        catch(const XMLException &e)
        {
                cout<<"Exception during DOM assignment -
"<<e.getMessage()<<endl<<endl;
                delete parser;
                return false;
        }
        delete parser;
        return true;
}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to