[GME-commit] GMESRC/GME/Parser MgaXslt.cpp,1.6,1.7
gme-commit at list.isis.vanderbilt.edu
gme-commit at list.isis.vanderbilt.edu
Fri Jun 17 16:54:17 CDT 2005
Update of /project/gme-repository/GMESRC/GME/Parser
In directory escher:/tmp/cvs-serv9324
Modified Files:
MgaXslt.cpp
Log Message:
Dummy, temporary mga.dtd file created in local directory, to fool Xalan.
CVS User: Zoltan Molnar, ISIS (zolmol)
Index: MgaXslt.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaXslt.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** MgaXslt.cpp 13 Oct 2004 15:17:55 -0000 1.6
--- MgaXslt.cpp 17 Jun 2005 15:54:15 -0000 1.7
***************
*** 2,5 ****
--- 2,6 ----
#include "MgaXslt.h"
#include "CommonStl.h"
+ #include <fstream>
#include <xalanc/Include/PlatformDefinitions.hpp>
***************
*** 37,40 ****
--- 38,43 ----
}
+ bool dtd_created = false;
+ std::string dtd_name;
try
{
***************
*** 61,64 ****
--- 64,92 ----
assert(theCompiledStylesheet != 0);
+ // make sure mga.dtd file exists in the directory of the in_file
+ // if file doesn't exist we create a temporary, empty mga.dtd file
+ // in that directory, which will be deleted after the transformation
+ int dir_end = in_file.rfind('\\');
+ if( dir_end != std::string::npos) // directory part found
+ dtd_name += in_file.substr( 0, dir_end+1);
+ dtd_name += "mga.dtd";
+
+ std::fstream dtd_file;
+ dtd_file.open( dtd_name.c_str(), std::ios_base::in);
+ if( !dtd_file.is_open()) // failure, we will create a temporary dtd file
+ {
+ dtd_created = true;
+ std::ofstream dtd_temp;
+ dtd_temp.open( dtd_name.c_str(), std::ios_base::out);
+ if( dtd_temp.is_open())
+ dtd_temp << "<!-- Temporary and empty dtd file to fool the Xalan transformer. -->";
+ else
+ throw "Error: mga.dtd file not found, and could not create a temporary one either!";
+
+ dtd_temp.close();
+ }
+ else // file found
+ dtd_file.close();
+
// Do the transform.
theResult = theXalanTransformer.transform
***************
*** 80,87 ****
--- 108,123 ----
}
}
+ catch( std::string& m)
+ {
+ error = m;
+ theResult = E_XSLT_ERROR;
+ }
catch( ...)
{
theResult = E_XSLT_ERROR;
}
+
+ if( dtd_created)
+ remove(dtd_name.c_str());
// Terminate Xalan...
More information about the GME-commit
mailing list