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 RIAUDEL Jean-Philippe <JP...@CPR.FR> on 2000/07/03 10:06:44 UTC

Pb with the DOMParser on Solaris 2.6 and C++ 5.0

Hi,

I'm developing on Solaris 2.6 with C++ 5.0.

After rebuilding xerces-c-src_1_2_0, i use the DOMParser class to parse my
XML file.

This is my code just after :


	#include <util/PlatformUtils.hpp>
	#include <dom/DOM_NamedNodeMap.hpp> 
	#include <dom/DOM_Node.hpp>
	#include <framework/XMLPScanToken.hpp> 

Calendar::Calendar (const RWCString& nomDevise_p)	
{	
	try {
		XMLPlatformUtils::Initialize();    
	}
	catch (const XMLException& toCatch)
	{
		cout << "Error during initialization! :\n" <<
toCatch.getMessage() << endl;
		//return 1;
	}
	
	DOMString domDevise("DEVISE");
	DOMString domJF("JOURFERIE");
	DOMString domNom("NOM");
	char *nomFic = "calendar.xml";

	DOMParser parser;
	
	DOMParser::ValSchemes valScheme = DOMParser::Val_Never;
    	bool doNamespaces = false;

	parser.setValidationScheme(valScheme);
	parser.setDoNamespaces(doNamespaces);

	try
	{
		parser.parse(nomFic);
	}
	catch (const XMLException& toCatch)
	{
		cout << "\nFile not found: '" << nomFic << "'\n"
			 << "Exception message is: \n"
			 << toCatch.getMessage() << "\n" ;
		//return -1;    }
	}
	catch(...){
		cout << "Erreur mais c'est pas grave !" <<endl << flush;
	}


	// File Parsing

	XMLPlatformUtils::Terminate();



	I coded an executable which call twice the constructor of my
Calendar class.
	The first call is good, but in the second call of the constructor,
it makes me a "segmentation fault" error when i declare my parser variable.

	I dont understand why...

	if someone could help me.

	Jean-Philippe



Re: Pb with the DOMParser on Solaris 2.6 and C++ 5.0

Posted by Dean Roddey <dr...@charmedquark.com>.
Pb with the DOMParser on Solaris 2.6 and C++ 5.0Its more than just that mutex. Its any global data. Some of them might just happen to survive a reinitialization, but it shouldn't be counted on. The method was designed to be called at process shutdown (or unload of a COM based DLL that loads and unloads the DLL dynamically), not to just on the fly initialize and terminate the parser.

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"You young, and you gotcha health. Whatchoo wanna job fer?"


  ----- Original Message ----- 
  From: Toni Baier 
  To: xerces-c-dev@xml.apache.org 
  Sent: Monday, July 03, 2000 1:18 AM
  Subject: RE: Pb with the DOMParser on Solaris 2.6 and C++ 5.0


  Hi Jean-Philippe!
   
  I had the same problem under Win32/VC6!
   
  The solution is to call XMLPlatformUtils::Terminate(); only *once*! (Have a look at my mail and the response a view mail above in the thread!)
   
  The reason is, that a static mutex for the XMLScanner is deleted through XMLPlatformUtils::Terminate(); and not reinitialized through XMLPlatformUtils::initialize() !!
  (Look at XMLScanner.cpp -> static XMLMutex& gScannerMutex() )
   
  So long...
   
   
  Toni


RE: Pb with the DOMParser on Solaris 2.6 and C++ 5.0

Posted by Toni Baier <to...@softing.com>.
Pb with the DOMParser on Solaris 2.6 and C++ 5.0Hi Jean-Philippe!

I had the same problem under Win32/VC6!

The solution is to call XMLPlatformUtils::Terminate(); only *once*! (Have a
look at my mail and the response a view mail above in the thread!)

The reason is, that a static mutex for the XMLScanner is deleted through
XMLPlatformUtils::Terminate(); and not reinitialized through
XMLPlatformUtils::initialize() !!
(Look at XMLScanner.cpp -> static XMLMutex& gScannerMutex() )

So long...


Toni