You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Si...@qml.com.au on 2001/12/27 07:14:13 UTC

DOM Document assignment crashing

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: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org