[GME-commit] GMESRC/GME/Parser MgaXslt.cpp,1.7,1.8

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Fri Jun 17 17:19:57 CDT 2005


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

Modified Files:
	MgaXslt.cpp 
Log Message:
Better fix. Using the real mga.dtd content for the temporary file.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: MgaXslt.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaXslt.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** MgaXslt.cpp	17 Jun 2005 15:54:15 -0000	1.7
--- MgaXslt.cpp	17 Jun 2005 16:19:55 -0000	1.8
***************
*** 8,11 ****
--- 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)
***************
*** 65,70 ****
  		
  				// 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
--- 183,190 ----
  		
  				// make sure mga.dtd file exists in the directory of the in_file
! 				// if file doesn't exist we create a temporary mga.dtd file
  				// in that directory, which will be deleted after the transformation
+ 				// the content of this file is the same as the latest original mga.dtd
+ 				// but Xalan can be fooled even with an empty file
  				int dir_end = in_file.rfind('\\');
  				if( dir_end != std::string::npos) // directory part found
***************
*** 80,84 ****
  					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!";
--- 200,204 ----
  					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!";



More information about the GME-commit mailing list