* Define a function for the XML-reading workaround in order to clean up a bit.

For the moment we keep to copies of it -- one for the use within the various
  musrfit programs, one that can be used in user functions.

* musrt0 is now again activated in musrgui/musredit by default.
This commit is contained in:
Bastian M. Wojek 2011-06-23 11:00:09 +00:00
parent dc48ea9712
commit caa3fdfc12
16 changed files with 174 additions and 505 deletions

View File

@ -418,9 +418,6 @@ int main(int argc, char *argv[])
}
// read startup file
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
char startup_path_name[128];
TSAXParser *saxParser = new TSAXParser();
PStartupHandler *startupHandler = new PStartupHandler();
@ -440,22 +437,9 @@ int main(int argc, char *argv[])
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
//status = saxParser->ParseFile(startup_path_name);
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PStartupHandler.cpp for the definition)
status = parseXmlFile(saxParser, startup_path_name);
// check for parse errors
if (status) { // error
cerr << endl << ">> any2many **WARNING** Reading/parsing musrfit_startup.xml failed.";

View File

@ -415,35 +415,19 @@ int PMsr2Data::SetRunNumbers(const string &runListFile)
*
* <p><b>return:</b>
* - 0 if everything went fine
* - return value of the ParseFile-method otherwise
* - return value of the parseXmlFile function otherwise
*/
int PMsr2Data::ParseXmlStartupFile()
{
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
int status;
fSaxParser = new TSAXParser();
fStartupHandler = new PStartupHandler();
string startup_path_name(fStartupHandler->GetStartupFilePath().Data());
fSaxParser->ConnectToHandler("PStartupHandler", fStartupHandler);
//status = fSaxParser->ParseFile(startup_path_name.c_str());
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = fSaxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PStartupHandler.cpp for the definition)
status = parseXmlFile(fSaxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << ">> msr2data: **WARNING** Reading/parsing musrfit_startup.xml failed." << endl;

View File

@ -42,6 +42,47 @@ using namespace std;
ClassImpQ(PStartupHandler)
//--------------------------------------------------------------------------
// This function is a replacement for the ParseFile method of TSAXParser.
// It is needed because in certain environments ParseFile does not work but ParseBuffer does.
//--------------------------------------------------------------------------
/**
* <p> Replacement for the ParseFile method of TSAXParser.
*
* <p><b>return:</b>
* - 1 if file cannot be read
* - 0 if the file has been parsed successfully
* - parse error code otherwise
*
* \param saxParser pointer to a TSAXParser object
* \param startup_path_name full path to the XML file to be read
*/
int parseXmlFile(TSAXParser *saxParser, const char *startup_path_name)
{
int status;
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
return status;
}
//--------------------------------------------------------------------------
// Constructor
//--------------------------------------------------------------------------

View File

@ -30,6 +30,7 @@
***************************************************************************/
#include <vector>
#include <fstream>
using namespace std;
#include "PUserFcnBase.h"
@ -56,5 +57,47 @@ PUserFcnBase::~PUserFcnBase()
{
}
//--------------------------------------------------------------------------
// This function is a replacement for the ParseFile method of TSAXParser.
// It is needed because in certain environments ParseFile does not work but ParseBuffer does.
//--------------------------------------------------------------------------
/**
* <p> Replacement for the ParseFile method of TSAXParser
* that can be used in user functions.
*
* <p><b>return:</b>
* - 1 if file cannot be read
* - 0 if the file has been parsed successfully
* - parse error code otherwise
*
* \param saxParser pointer to a TSAXParser object
* \param startup_path_name full path to the XML file to be read
*/
Int_t parseXmlFile(TSAXParser *saxParser, const char *startup_path_name)
{
Int_t status;
fstream xmlFile;
UInt_t xmlSize = 0;
Char_t *xmlBuffer = 0;
xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new Char_t[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
return status;
}
// place a void pointer vector for global user function objects which might be needed
vector<void *> gGlobalUserFcn;

View File

@ -33,7 +33,6 @@
#include <cmath>
#include <iostream>
#include <fstream>
using namespace std;
#include <TSAXParser.h>
@ -66,26 +65,9 @@ PMagProximityFitterGlobal::PMagProximityFitterGlobal()
strcpy(startup_path_name, fStartupHandler->GetStartupFilePath().Data());
saxParser->ConnectToHandler("PMPStartupHandler", fStartupHandler);
//Int_t status = saxParser->ParseFile(startup_path_name);
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
Int_t status;
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
Int_t status = parseXmlFile(saxParser, startup_path_name);
// check for parse errors
if (status) { // error
cout << endl << ">> PMagProximityFitterGlobal::PMagProximityFitterGlobal: **WARNING** Reading/parsing mag_proximity_startup.xml failed.";

View File

@ -33,7 +33,6 @@
#include <cmath>
#include <iostream>
#include <fstream>
using namespace std;
#include <TSAXParser.h>
@ -65,26 +64,9 @@ PNL_PippardFitterGlobal::PNL_PippardFitterGlobal()
strcpy(startup_path_name, fStartupHandler->GetStartupFilePath().Data());
saxParser->ConnectToHandler("PNL_StartupHandler", fStartupHandler);
//Int_t status = saxParser->ParseFile(startup_path_name);
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
Int_t status;
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
Int_t status = parseXmlFile(saxParser, startup_path_name);
// check for parse errors
if (status) { // error
cout << endl << ">> PNL_PippardFitterGlobal::PNL_PippardFitterGlobal: **WARNING** Reading/parsing nonlocal_startup.xml failed.";

View File

@ -30,7 +30,6 @@
#include "TLondon1D.h"
#include <iostream>
#include <fstream>
#include <cassert>
#include <cmath>
using namespace std;
@ -155,26 +154,9 @@ TLondon1DHS::TLondon1DHS() : fCalcNeeded(true), fFirstCall(true) {
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
int status;
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@ -323,26 +305,9 @@ TLondon1D1L::TLondon1D1L() : fCalcNeeded(true), fFirstCall(true) {
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
int status;
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@ -526,26 +491,9 @@ TLondon1D2L::TLondon1D2L() : fCalcNeeded(true), fFirstCall(true) {
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
int status;
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@ -716,26 +664,9 @@ TProximity1D1LHS::TProximity1D1LHS() : fCalcNeeded(true), fFirstCall(true) {
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
int status;
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@ -883,26 +814,9 @@ TLondon1D3L::TLondon1D3L() : fCalcNeeded(true), fFirstCall(true) {
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
int status;
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@ -1072,26 +986,9 @@ TLondon1D3LS::TLondon1D3LS() : fCalcNeeded(true), fFirstCall(true) {
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
int status;
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@ -1261,26 +1158,9 @@ double TLondon1D3LS::operator()(double t, const vector<double> &par) const {
// BMWStartupHandler *startupHandler = new BMWStartupHandler();
// saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
// //int status (saxParser->ParseFile(startup_path_name.c_str()));
// // parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
// fstream xmlFile;
// unsigned int xmlSize = 0;
// char *xmlBuffer = 0;
// xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
// if (xmlFile.is_open()) { // check if file has been opened successfully
// xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
// xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
// xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
// xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
// xmlFile.close(); // close the XML file
// }
// int status;
// if (!xmlBuffer) { // file has not been read into the buffer
// status = 1;
// } else {
// status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
// delete[] xmlBuffer; // free the buffer memory
// xmlBuffer = 0;
// }
// // parsing the file as above seems to lead to problems in certain environments;
// // use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
// int status = parseXmlFile(saxParser, startup_path_name.c_str());
// // check for parse errors
// if (status) { // error
// cout << endl << "**WARNING** Reading/parsing " << startup_path_name << " failed." << endl;

View File

@ -30,7 +30,6 @@
#include "TVortex.h"
#include <iostream>
#include <fstream>
#include <cassert>
#include <cmath>
using namespace std;
@ -167,26 +166,9 @@ TBulkTriVortexLondon::TBulkTriVortexLondon() : fCalcNeeded(true), fFirstCall(tru
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
int status;
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@ -244,26 +226,9 @@ TBulkSqVortexLondon::TBulkSqVortexLondon() : fCalcNeeded(true), fFirstCall(true)
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
int status;
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@ -491,26 +456,9 @@ TBulkTriVortexML::TBulkTriVortexML() : fCalcNeeded(true), fFirstCall(true) {
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
int status;
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@ -647,26 +595,9 @@ TBulkTriVortexAGL::TBulkTriVortexAGL() : fCalcNeeded(true), fFirstCall(true) {
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
int status;
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@ -802,26 +733,9 @@ TBulkTriVortexAGLII::TBulkTriVortexAGLII() : fCalcNeeded(true), fFirstCall(true)
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
int status;
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@ -970,26 +884,9 @@ TBulkTriVortexNGL::TBulkTriVortexNGL() : fCalcNeeded(true), fFirstCall(true) {
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
int status;
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@ -1142,26 +1039,9 @@ TBulkAnisotropicTriVortexLondonGlobal::TBulkAnisotropicTriVortexLondonGlobal() :
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
int status;
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@ -1401,26 +1281,9 @@ TBulkAnisotropicTriVortexMLGlobal::TBulkAnisotropicTriVortexMLGlobal() : fCalcNe
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
int status;
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@ -1660,26 +1523,9 @@ TBulkAnisotropicTriVortexAGLGlobal::TBulkAnisotropicTriVortexAGLGlobal() : fCalc
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
int status;
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \

View File

@ -35,7 +35,6 @@
#include <cassert>
#include <sys/time.h>
#include <iostream>
#include <fstream>
#include <cmath>
#ifdef HAVE_GOMP
@ -203,26 +202,9 @@ TLFDynGssKT::TLFDynGssKT() : fCalcNeeded(true), fFirstCall(true), fCounter(0) {
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
int status;
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
@ -545,26 +527,9 @@ TLFDynExpKT::TLFDynExpKT() : fCalcNeeded(true), fFirstCall(true), fCounter(0), f
BMWStartupHandler *startupHandler = new BMWStartupHandler();
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
//int status (saxParser->ParseFile(startup_path_name.c_str()));
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
xmlFile.open(startup_path_name.c_str(), ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
int status;
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \

View File

@ -36,9 +36,15 @@
#include <TQObject.h>
#include <TList.h>
#include <TString.h>
#include <TSAXParser.h>
#include "PMusr.h"
//--------------------------------------------------------------------------
// This function is a replacement for the ParseFile method of TSAXParser.
//--------------------------------------------------------------------------
int parseXmlFile(TSAXParser*, const char*);
/**
* <p>Handles the XML musrfit startup file (musrfit_startup.xml) in which default settings
* are stored:

View File

@ -36,6 +36,7 @@
using namespace std;
#include "TObject.h"
#include "TSAXParser.h"
//--------------------------------------------------------------------------------------------
/**
@ -56,4 +57,9 @@ class PUserFcnBase : public TObject
ClassDef(PUserFcnBase, 1)
};
//--------------------------------------------------------------------------
// This function is a replacement for the ParseFile method of TSAXParser.
//--------------------------------------------------------------------------
Int_t parseXmlFile(TSAXParser*, const Char_t*);
#endif // _PUSERFCNBASE_H_

View File

@ -9,7 +9,7 @@
<default_save_path>./</default_save_path>
<msr_default_file_path>$HOME/analysis/musrfit/src/musredit</msr_default_file_path>
<title_from_data_file>y</title_from_data_file>
<enable_musrt0>n</enable_musrt0>
<enable_musrt0>y</enable_musrt0>
</general>
<help_section>
<musr_web_main>http://lmu.web.psi.ch/facilities/software/musrfit/user/MUSR/MusrFit.html</musr_web_main>

View File

@ -424,9 +424,6 @@ int main(int argc, char *argv[])
}
// read startup file
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
char startup_path_name[128];
TSAXParser *saxParser = new TSAXParser();
PStartupHandler *startupHandler = new PStartupHandler();
@ -446,22 +443,9 @@ int main(int argc, char *argv[])
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
//status = saxParser->ParseFile(startup_path_name);
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PStartupHandler.cpp for the definition)
status = parseXmlFile(saxParser, startup_path_name);
// check for parse errors
if (status) { // error
cerr << endl << ">> musrfit **WARNING** Reading/parsing musrfit_startup.xml failed.";

View File

@ -9,7 +9,7 @@
<default_save_path>./</default_save_path>
<msr_default_file_path>$HOME/analysis/musrfit/src/musrgui</msr_default_file_path>
<title_from_data_file>n</title_from_data_file>
<enable_musrt0>n</enable_musrt0>
<enable_musrt0>y</enable_musrt0>
</general>
<font_settings>
<font_name>Courier</font_name>

View File

@ -34,7 +34,6 @@
#include <string.h>
#include <iostream>
#include <fstream>
using namespace std;
#include <TApplication.h>
@ -276,9 +275,6 @@ Int_t main(Int_t argc, Char_t *argv[])
}
// read startup file
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
Char_t startup_path_name[128];
TSAXParser *saxParser = new TSAXParser();
PStartupHandler *startupHandler = new PStartupHandler();
@ -298,22 +294,9 @@ Int_t main(Int_t argc, Char_t *argv[])
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
//status = saxParser->ParseFile(startup_path_name);
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PStartupHandler.cpp for the definition)
status = parseXmlFile(saxParser, startup_path_name);
// check for parse errors
if (status) { // error
cerr << endl << ">> musrt0 **WARNING** Reading/parsing musrfit_startup.xml failed.";

View File

@ -34,7 +34,6 @@
#include <string.h>
#include <iostream>
#include <fstream>
using namespace std;
#include <TApplication.h>
@ -159,9 +158,6 @@ int main(int argc, char *argv[])
}
// read startup file
fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
char startup_path_name[128];
TSAXParser *saxParser = new TSAXParser();
PStartupHandler *startupHandler = new PStartupHandler();
@ -181,22 +177,9 @@ int main(int argc, char *argv[])
strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data());
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
//status = saxParser->ParseFile(startup_path_name);
// parsing the file as above seems to lead to problems in certain environments; try working around through a buffer as follows
xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
}
if (!xmlBuffer) { // file has not been read into the buffer
status = 1;
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
}
// parsing the file as above seems to lead to problems in certain environments;
// use the parseXmlFile function instead (see PStartupHandler.cpp for the definition)
status = parseXmlFile(saxParser, startup_path_name);
// check for parse errors
if (status) { // error
cerr << endl << ">> musrview **WARNING** Reading/parsing musrfit_startup.xml failed.";