[GME-commit] GMESRC/GME/Parser MgaXslt.cpp,1.8,1.9 MgaXslt.h,1.2,1.3

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Wed Aug 31 21:46:21 CDT 2005


Update of /project/gme-repository/GMESRC/GME/Parser
In directory escher:/tmp/cvs-serv27035

Modified Files:
	MgaXslt.cpp MgaXslt.h 
Log Message:
Mga.dtd extracted from resources in case of XSL transformations (instead of copying the file from global var).


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: MgaXslt.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaXslt.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** MgaXslt.cpp	17 Jun 2005 16:19:55 -0000	1.8
--- MgaXslt.cpp	31 Aug 2005 20:46:19 -0000	1.9
***************
*** 8,129 ****
  #include <xalanc/XalanTransformer/XalanTransformer.hpp>
  
! static const char * mga_dtd_content = "\
! <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
! \n\
! <!ENTITY lt     \"&#38;#60;\">\n\
! <!ENTITY gt     \"&#62;\">\n\
! <!ENTITY amp    \"&#38;#38;\">\n\
! <!ENTITY apos   \"&#39;\"> \n\
! <!ENTITY quot   \"&#34;\">\n\
! \n\
! <!ELEMENT project (name, comment?, author?, folder)>\n\
! <!ATTLIST project\n\
! 	version		CDATA		#IMPLIED\n\
! 	guid		CDATA		#IMPLIED\n\
! 	cdate		CDATA		#IMPLIED\n\
! 	mdate		CDATA		#IMPLIED\n\
! 	metaversion	CDATA		#IMPLIED\n\
! 	metaguid	CDATA		#IMPLIED\n\
! 	metaname	CDATA		#REQUIRED\n\
! >\n\
! \n\
! <!ELEMENT name (#PCDATA)>\n\
! <!ELEMENT comment (#PCDATA)>\n\
! <!ELEMENT author (#PCDATA)>\n\
! <!ELEMENT value (#PCDATA)>\n\
! \n\
! <!ELEMENT constraint (name, value)>\n\
! \n\
! <!ELEMENT regnode (value, regnode*)>\n\
! <!ATTLIST regnode\n\
! 	name		CDATA		#REQUIRED\n\
! 	status		(inherited|meta|undefined) #IMPLIED\n\
! 	isopaque	(yes|no)	\"no\"\n\
! >\n\
! \n\
! <!ELEMENT folder (name, (regnode|constraint|folder|model|atom|reference|set|connection)*)>\n\
! <!ATTLIST folder\n\
! 	id			ID			#IMPLIED\n\
! 	kind		NMTOKEN		#REQUIRED\n\
! 	relid		CDATA		#IMPLIED\n\
! 	childrelidcntr	CDATA	#IMPLIED\n\
! 	libref		CDATA		#IMPLIED\n\
! >\n\
! \n\
! <!ELEMENT model (name, (regnode|constraint|attribute|model|atom|reference|set|connection)*)>\n\
! <!ATTLIST model\n\
! 	id			ID			#IMPLIED\n\
! 	kind		NMTOKEN		#REQUIRED\n\
! 	role		NMTOKEN		#IMPLIED\n\
! 	derivedfrom	IDREF		#IMPLIED\n\
! 	isinstance	(yes|no)	\"no\"\n\
! 	isprimary	(yes|no)	\"yes\"\n\
! 	relid		CDATA		#IMPLIED\n\
! 	childrelidcntr	CDATA		#IMPLIED\n\
! >\n\
! \n\
! <!ELEMENT atom (name, (regnode|constraint|attribute)*)>\n\
! <!ATTLIST atom\n\
! 	id			ID			#IMPLIED\n\
! 	kind		NMTOKEN		#REQUIRED\n\
! 	role		NMTOKEN		#IMPLIED\n\
! 	derivedfrom	IDREF		#IMPLIED\n\
! 	isinstance	(yes|no)	\"no\"\n\
! 	isprimary	(yes|no)	\"yes\"\n\
! 	relid		CDATA		#IMPLIED\n\
! >\n\
! \n\
! <!ELEMENT reference (name, (regnode|constraint|attribute)*)>\n\
! <!ATTLIST reference\n\
! 	id			ID			#IMPLIED\n\
! 	kind		NMTOKEN		#REQUIRED\n\
! 	role		NMTOKEN		#IMPLIED\n\
! 	derivedfrom	IDREF		#IMPLIED\n\
! 	isinstance	(yes|no)	\"no\"\n\
! 	isprimary	(yes|no)	\"yes\"\n\
! 	referred	IDREF		#IMPLIED\n\
! 	isbound		(yes|no)	\"no\"\n\
! 	relid		CDATA		#IMPLIED\n\
! >\n\
! \n"		// partitioned to be below 2048 limit
! "<!ELEMENT set (name, (regnode|constraint|attribute)*)>\n\
! <!ATTLIST set\n\
! 	id			ID			#IMPLIED\n\
! 	kind		NMTOKEN		#REQUIRED\n\
! 	role		NMTOKEN		#IMPLIED\n\
! 	derivedfrom	IDREF		#IMPLIED\n\
! 	isinstance	(yes|no)	\"no\"\n\
! 	isprimary	(yes|no)	\"yes\"\n\
! 	members		IDREFS		#IMPLIED\n\
! 	isbound		(yes|no)	\"no\"\n\
! 	relid		CDATA		#IMPLIED\n\
! >\n\
! \n\
! <!ELEMENT connection (name?, (regnode|constraint|connpoint|attribute)*)>\n\
! <!ATTLIST connection\n\
! 	id			ID			#IMPLIED\n\
! 	kind		NMTOKEN		#REQUIRED\n\
! 	role		NMTOKEN		#IMPLIED\n\
! 	derivedfrom	IDREF		#IMPLIED\n\
! 	isinstance	(yes|no)	\"no\"\n\
! 	isprimary	(yes|no)	\"yes\"\n\
! 	isbound		(yes|no)	\"no\"\n\
! 	relid		CDATA		#IMPLIED\n\
! >\n\
! \n\
! <!ELEMENT connpoint EMPTY>\n\
! <!ATTLIST connpoint\n\
! 	role		NMTOKEN		#REQUIRED\n\
! 	target		IDREF		#REQUIRED\n\
! 	refs		IDREFS		#IMPLIED\n\
! 	isbound		(yes|no)	\"no\"\n\
! >\n\
! \n\
! <!ELEMENT attribute (value, regnode*)>\n\
! <!ATTLIST attribute\n\
! 	kind		NMTOKEN		#REQUIRED\n\
! 	status		(inherited|meta) #IMPLIED\n\
! >\n\
! ";
  
  STDMETHODIMP CMgaXslt::ApplyXslt( BSTR p_stylesheet_f_name, BSTR p_in_f_name, BSTR p_out_f_name, BSTR * out_error)
--- 8,28 ----
  #include <xalanc/XalanTransformer/XalanTransformer.hpp>
  
! std::string CMgaXslt::getMgaDTDFromResource()
! {
! 	HMODULE hm = GetModuleHandle("PARSER2.DLL");
! 	if( !hm) return "";
! 
! 	HRSRC res1 = FindResource(hm, "MGA.DTD", "DTD");
! 	if( !res1) return "";
! 	
! 	HGLOBAL res2 = LoadResource(hm, res1);
! 	if( !res2) return "";
! 	
! 	char *data = ( char* )LockResource( res2);
! 	if( !data) return "";
! 
! 	DWORD uLen = SizeofResource(hm, res1);
! 	return std::string( data, uLen);
! }
  
  STDMETHODIMP CMgaXslt::ApplyXslt( BSTR p_stylesheet_f_name, BSTR p_in_f_name, BSTR p_out_f_name, BSTR * out_error)
***************
*** 196,208 ****
  				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 << mga_dtd_content;
! 					else
! 						throw "Error: mga.dtd file not found, and could not create a temporary one either!";
  
! 					dtd_temp.close();
  				}
  				else // file found
--- 95,111 ----
  				if( !dtd_file.is_open()) // failure, we will create a temporary dtd file
  				{
! 					std::string mga_dtd_content = getMgaDTDFromResource();
! 					if( mga_dtd_content.length() > 0 )
! 					{
! 						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 << mga_dtd_content;
! 						else
! 							throw "Error: mga.dtd file not found, and could not create a temporary one either!";
  
! 						dtd_temp.close();
! 					}
  				}
  				else // file found

Index: MgaXslt.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaXslt.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MgaXslt.h	15 Apr 2004 22:48:10 -0000	1.2
--- MgaXslt.h	31 Aug 2005 20:46:19 -0000	1.3
***************
*** 31,35 ****
  
  // ------- Attributes and Methods
! 
  };
  
--- 31,36 ----
  
  // ------- Attributes and Methods
! private:
! 	std::string getMgaDTDFromResource();
  };
  



More information about the GME-commit mailing list