<?xml version="1.0" encoding="utf-8"?>
			
			<rss version="2.0">
			<channel>
			<title>Wayne Graham&apos;s Blog - modelglue</title>
			<link>http://swem.wm.edu/blogs/waynegraham/index.cfm</link>
			<description>ColdFusion Development for Academic Libraries</description>
			<language>en-us</language>
			<pubDate>Sun, 22 Nov 2009 15:49:56 -0500</pubDate>
			<lastBuildDate>Mon, 30 Apr 2007 08:30:00 -0500</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>wsgrah@wm.edu</managingEditor>
			<webMaster>wsgrah@wm.edu</webMaster>
			
			
			
			
			
			<item>
				<title>Her Royal Majesty</title>
				<link>http://swem.wm.edu/blogs/waynegraham/index.cfm/2007/4/30/Her-Royal-Majesty</link>
				<description>
				
				Ok, it&apos;s been a while. I&apos;ve been working on some non-ColdFusion projects so I&apos;ve been a bit remiss in keeping things up-to-date here. But big news (at least for William and Mary). Her Royal Majesty, Queen Elizabeth II will be visiting William and Mary this Friday as part Jamestown&apos;s 400th anniversary. 

Normally this wouldn&apos;t be related to ColdFusion at all, but last week it was announced that she would be coming here and thus ensued a mad rush to get an &lt;a href=&quot;http://swem.wm.edu/exhibits/queen/&quot;&gt;online exhibit of the Queen&apos;s 1957 visit up&lt;/a&gt; that would make available pretty much everything we have stored in our Special Collections from her previous visit. I got to use Model-Glue after a long time of not looking at it. I had almost forgotten how painless Model-Glue makes putting projects like this together.

I just wanted to give a big thanks to Joe Rinehart and Doug Hughes  for bringing the &quot;rapid&quot; back into rapid application development!
				
				</description>
						
				
				<category>ColdFusion</category>				
				
				<category>modelglue</category>				
				
				<pubDate>Mon, 30 Apr 2007 08:30:00 -0500</pubDate>
				<guid>http://swem.wm.edu/blogs/waynegraham/index.cfm/2007/4/30/Her-Royal-Majesty</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>MG Unity</title>
				<link>http://swem.wm.edu/blogs/waynegraham/index.cfm/2006/6/23/MG-Unity</link>
				<description>
				
				It&apos;s been a while since I&apos;ve written on this blog...I&apos;m attempting to keep this one on CF. Anyway, MG Unity has come out and I have to admit that I&apos;m REALLY glad it has. 

I&apos;ve been working on a project with five academics from four different institutions looking at the vernacular architecture of the Colonial Chesapeake to 1720 for an article in the William and Mary Quarterly for the 2007 celebration of Jamestown. The objective was to write an scholarly article that looks at everything that has been excavated and see if the arguments of past scholars still hold. Not only were the scholars looking at individual sites as an aggregate, but wanted to track changes to the structures over time (additions, fireplaces, cellars, etc.). 

I knew this was going to be a challenging project from the beginning, so I attempted to set the expectations early for the application development cycle. I thought it a fluke that I actually got them all to aggree on a set of important fields and tables before I started coding anything (a first for me). However, as I got into the project a bit more, requests for additional fields here, moving this data to this table, all while attempting to support constant input into the application got to be a bit more than was really feasible for a &quot;spare-time&quot; project. 

I had set out to use as good of coding practices as I could. Each table had its own DAO, gateway, TOs, validators, etc. However, each change to these fields made me keep mucking around in these files and the forms calling the objects. After a while of making constant changes, I fell back on some old &quot;bad&quot; practices and kind of strong-armed some of the solution with spaghetti code...and I hated myself for it because I knew that I would have to come back at a later date to fix it.

About this time Joe started doing some work with Arf! And Doug Hughes started work on Reactor. I continued to code in my bad style, but since I knew what I had done, I just kept doing it.

After the project members presented their paper, I set the project down for a while since my daughter had just been born. Since Joe brought out Unity, I decided now was as good a time as any to pick up the refactoring of the project. 

All I can say is that what I&apos;ve done in half-a-day with Unity would take me three- to four-times longer my old way. The scaffolds (once I figured out how they were working) have been an absolute godsend for the rather complex relationships between phases of construction and the overall archaeological and architectural record. The Reactor syntax is so easy (especially since ColdSpring seperates all the configuration) that everything just clicks. 

The entire framework is just so intuitive (at least compared to my previous experiences with frameworks). The ability to not have to worry any more about building the basic web pages, forms, CRUD, and displays makes Unity a pleasure. Also, changes will be a breeze compared to what they entailed a couple of months ago, which will allow me to do some of the cool stuff I had planned with Google Maps and Google Earth to map out the locations of these archeaological/historical sites!
				
				</description>
						
				
				<category>Web</category>				
				
				<category>ColdFusion</category>				
				
				<category>modelglue</category>				
				
				<pubDate>Fri, 23 Jun 2006 14:27:00 -0500</pubDate>
				<guid>http://swem.wm.edu/blogs/waynegraham/index.cfm/2006/6/23/MG-Unity</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Model-Glue Project Files</title>
				<link>http://swem.wm.edu/blogs/waynegraham/index.cfm/2006/1/9/ModelGlue-Project-Files</link>
				<description>
				
				I found myself building more Model-Glue apps and got tired of the copy-paste involved so I wrote an ANT script to automate this. It&apos;s nice because now in Eclipse, I just throw the build.xml file into the directory I want to put the model-glue files to be, right-click and select Run As --&gt; Ant Build. 

If you&apos;d like to try it out, here&apos;s the code for build.xml:

&lt;code&gt;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;project name=&quot;build-mg&quot; default=&quot;setup&quot; basedir=&quot;.&quot;&gt;
	&lt;description&gt;
		Builds a new ModelGlue project
	&lt;/description&gt;

	&lt;property name=&quot;srcURL&quot; value=&quot;http://www.model-glue.com/modelglue_1_0_01.zip&quot; /&gt;

	&lt;!-- =================================
	target: setup
	================================= --&gt;
	&lt;target name=&quot;setup&quot; depends=&quot;init,downloadZip,unzip,cleanDirs,renameApp&quot; 
		description=&quot;--&gt;Sets up a default MG project&quot;&gt;
		&lt;tstamp/&gt;
		&lt;echo message=&quot;Build fininshed at ${DSTAMP}&quot; /&gt;
	&lt;/target&gt;

	&lt;!-- - - - - - - - - - - - - - - - - -
	target: deploy
	- - - - - - - - - - - - - - - - - --&gt;
	&lt;target name=&quot;deploy&quot; description=&quot;Deploys code to server&quot;&gt;
		&lt;!-- TODO: Implement your deployment script(s) here --&gt;
	&lt;/target&gt;

	&lt;!-- - - - - - - - - - - - - - - - - -
	target: renameApp
	- - - - - - - - - - - - - - - - - --&gt;
	&lt;target name=&quot;init&quot; description=&quot;Build directory structure&quot;&gt;
		&lt;mkdir dir=&quot;tmp&quot;/&gt;
	&lt;/target&gt;

	&lt;!-- - - - - - - - - - - - - - - - - -
	target: renameApp
	- - - - - - - - - - - - - - - - - --&gt;
	&lt;target name=&quot;renameApp&quot; description=&quot;Moves default files into ${basedir}&quot;&gt;
		&lt;move todir=&quot;${basedir}&quot;&gt;
			&lt;fileset dir=&quot;${basedir}/modelglueapplicationtemplate&quot;&gt;
				&lt;exclude name=&quot;build**&quot; /&gt;
			&lt;/fileset&gt;
		&lt;/move&gt;
	&lt;/target&gt;

	&lt;!-- - - - - - - - - - - - - - - - - -
	target: cleanDirs
	- - - - - - - - - - - - - - - - - --&gt;
	&lt;target name=&quot;cleanDirs&quot; description=&quot;clean up&quot;&gt;
		&lt;delete dir=&quot;${basedir}/Documentation&quot; /&gt;
		&lt;delete dir=&quot;${basedir}/modelgluesamples&quot; /&gt;
		&lt;delete dir=&quot;${basedir}/tmp&quot; /&gt;

		&lt;delete&gt;
			&lt;fileset dir=&quot;.&quot;&gt;
				&lt;include name=&quot;**/*.txt&quot;/&gt;
				&lt;exclude name=&quot;**/*.xml&quot;/&gt;
			&lt;/fileset&gt;
		&lt;/delete&gt;
	&lt;/target&gt;

	&lt;!-- - - - - - - - - - - - - - - - - -
	target: unzip
	- - - - - - - - - - - - - - - - - --&gt;
	&lt;target name=&quot;unzip&quot; description=&quot;Unzip the file&quot;&gt;
		&lt;unzip src=&quot;${basedir}/tmp/modelglue.zip&quot; dest=&quot;${basedir}&quot; /&gt;
	&lt;/target&gt;

	&lt;!-- - - - - - - - - - - - - - - - - -
	target: downloadZip
	- - - - - - - - - - - - - - - - - --&gt;
	&lt;target name=&quot;downloadZip&quot; depends=&quot;init&quot; description=&quot;Download the
		zip file for ModelGlue&quot;&gt;
		&lt;get src=&quot;${srcURL}&quot; dest=&quot;${basedir}/tmp/modelglue.zip&quot;
			verbose=&quot;true&quot; usetimestamp=&quot;true&quot; /&gt;
	&lt;/target&gt;

&lt;/project&gt;
&lt;/code&gt;

You can also pull the SVN version with the &lt;a href=&quot;http://subclipse.tigris.org/svnant.html&quot;&gt;SVN Ant&lt;/a&gt; task from the &lt;a href=&quot;http://subclipse.tigris.org/&quot;&gt;Subclipse&lt;/a&gt; with a small change. Instead of using the get task, use the svn export:

&lt;code&gt;
&lt;svn javahl=&quot;${javahl}&quot;&gt;
	&lt;export srcURL=&quot;svn://clearsoftware.net/clearsoftware.net/ModelGlue&quot; destPath=&quot;${basedir}&quot; /&gt;
&lt;/svn&gt;
&lt;/code&gt;

You may have a little more cleanup to do using this method, but it should be pretty darn easy.
				
				</description>
						
				
				<category>ColdFusion</category>				
				
				<category>modelglue</category>				
				
				<pubDate>Mon, 09 Jan 2006 16:43:00 -0500</pubDate>
				<guid>http://swem.wm.edu/blogs/waynegraham/index.cfm/2006/1/9/ModelGlue-Project-Files</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Controller Generator Update</title>
				<link>http://swem.wm.edu/blogs/waynegraham/index.cfm/2006/1/5/Controller-Generator-Update</link>
				<description>
				
				Ray asked an interesting question on the modelglue list about what is the proper way to return from a controller CFC. In older versions of Model Glue, you had to return the event; however, there have been changes made that pass event objects by reference, making returning the event obsolete. I had missed this subtle change and the generator XSL was return the event passed to it. I&apos;ve updated the code to return void.

So, you can point your transformer to &lt;a href=&quot;http://swem.wm.edu/blogs/waynegraham/software/mg-stub-generator.xsl&quot;&gt;http://swem.wm.edu/blogs/waynegraham/software/mg-stub-generator.xsl&lt;/a&gt; (or download it and change it to your liking) to reflect the updated method.
				
				</description>
						
				
				<category>ColdFusion</category>				
				
				<category>modelglue</category>				
				
				<category>XML</category>				
				
				<pubDate>Thu, 05 Jan 2006 09:37:00 -0500</pubDate>
				<guid>http://swem.wm.edu/blogs/waynegraham/index.cfm/2006/1/5/Controller-Generator-Update</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Stub Generator for Model-Glue</title>
				<link>http://swem.wm.edu/blogs/waynegraham/index.cfm/2006/1/1/Stub-Generator-for-ModelGlue</link>
				<description>
				
				In working on a recent project, I got tired of going back and forth between my modelglue config file and then writing controllers, so I wrote an XSLT to generate method stubs for me. This stylesheet takes the modelglue.xml in the config folder and generates controller files with method stubs. Nothing too fancy, just &lt;!--- TODO: Implement $function-name function ---&gt; with default controller stub code. 

So, here are some warnings...

DO NOT test this code out on a live app. It can overwrite your existing controller(s) and leave you with just method stubs. 

I use the XSLT 2.0 &lt;xsl:result-document /&gt; element to write the resulting CFC file, so you&apos;ll need an XSLT 2.0 compliant processor (&lt;a href=&quot;http://saxon.sourceforge.net/&quot;&gt;Saxon 8&lt;/a&gt; is currently the only one available). I use &lt;a href=&quot;http://www.oxygenxml.com&quot;&gt;oXygen&apos;s&lt;/a&gt; Eclipse plugin and all you have to do is point the XSL URL to http://swem.wm.edu/blogs/waynegraham/software/mg-stub-generator.xsl (or &lt;a href=&quot;http://swem.wm.edu/blogs/waynegraham/software/mg-stub-generator.xsl&quot;&gt;download it&lt;/a&gt;) and change the transformer to Saxon8B. 

One last note, most of the samples for modelglue have the default controller named &quot;myController&quot; which can be different from the actual path to you controller. The XSLT is based on the name attribute of the controller element, so make sure you change this value to what you want your controller file to be named.

So, what does the code look like? Like I said, it&apos;s relatively simple (less than 40 lines). First, I set the output method to text and then loop over each of the controller nodes creating a file for each:

&lt;code&gt;
&lt;xsl:output method=&quot;text&quot;/&gt;
&lt;xsl:strip-space elements=&quot;*&quot;/&gt;

&lt;xsl:template match=&quot;/&quot;&gt;
	&lt;xsl:for-each select=&quot;/modelglue/controllers/controller&quot;&gt;
		&lt;xsl:variable name=&quot;filename&quot; select=&quot;concat(&apos;../controller/&apos;,@name, &apos;.cfc&apos;)&quot; /&gt;
		&lt;xsl:message&gt;
			Creating &lt;xsl:value-of select=&quot;$filename&quot;/&gt;
		&lt;/xsl:message&gt;
		&lt;xsl:result-document href=&quot;{$filename}&quot; method=&quot;text&quot; indent=&quot;yes&quot;&gt;
			&lt;xsl:call-template name=&quot;mg-controller&quot; /&gt;
		&lt;/xsl:result-document&gt;
	&lt;/xsl:for-each&gt;
&lt;/xsl:template&gt;
&lt;/code&gt; 

The filename variable is actually what tells the &lt;xsl:result-document /&gt; entity where to write the file, so if you want the stub in a different place, just change the relative path. This code assumes that you&apos;re currently in the /appname/config folder. In the xsl for loop, I call a template (mg-controller) that actually creates the component code.

&lt;code&gt;
&lt;xsl:template name=&quot;mg-controller&quot;&gt;
&amp;lt;cfcomponent name=&quot;&lt;xsl:value-of select=&quot;@name&quot;/&gt;&quot; displayname=&quot;&lt;xsl:value-of select=&quot;@name&quot;/&gt;&quot; output=&quot;false&quot; hint=&quot;I am a generated controller&quot; extends=&quot;ModelGlue.Core.Controller&quot;&amp;gt;
	&amp;lt;cffunction name=&quot;init&quot; access=&quot;Public&quot; returnType=&quot;Controller&quot; output=&quot;false&quot; hint=&quot;I build a new controller&quot;&amp;gt;
		&amp;lt;cfargument name=&quot;ModelGlue&quot; required=&quot;true&quot; type=&quot;ModelGlue.ModelGlue&quot; /&amp;gt;
		&amp;lt;cfargument name=&quot;InstanceName&quot; required=&quot;true&quot; type=&quot;string&quot; /&amp;gt;
		&amp;lt;cfset super.Init(arguments.ModelGlue) /&amp;gt;

		&amp;lt;!--- Controllers are in the application scope: Put any application startup code here. ---&amp;gt;

		&amp;lt;cfreturn this /&amp;gt;
	&amp;lt;/cffunction&amp;gt;
	&lt;xsl:for-each select=&quot;message-listener&quot;&gt;
	&lt;xsl:sort select=&quot;@function&quot;/&gt;
	&amp;lt;cffunction name=&quot;&lt;xsl:value-of select=&quot;@function&quot;/&gt;&quot; access=&quot;Public&quot; returnType=&quot;ModelGlue.Core.Event&quot; output=&quot;false&quot; hint=&quot;I am an event handler.&quot;&amp;gt;
		&amp;lt;cfargument name=&quot;event&quot; type=&quot;ModelGlue.Core.Event&quot; required=&quot;true&quot;&amp;gt;
		&amp;lt;!--- TODO: Implement &lt;xsl:value-of select=&quot;@function&quot; /&gt; function ---&amp;gt;

		&amp;lt;cfreturn arguments.event /&amp;gt;
		&amp;lt;/cffunction&amp;gt;
	&lt;/xsl:for-each&gt;
&amp;lt;/cfcomponent&amp;gt;
&lt;/xsl:template&gt;
&lt;/code&gt;

You might notice that the tabs are a little out of wack...this is on purpose since text output keeps the same tab structure that is in the resulting code.

What would be really nice is to adapt the code to get something like MyEclipse&apos;s Struts editor that allows you to graphically map out your nodes and pages by filling out a wizard. Now if I can just figure out Eclipse&apos;s GEF...
				
				</description>
						
				
				<category>ColdFusion</category>				
				
				<category>modelglue</category>				
				
				<category>XML</category>				
				
				<pubDate>Sun, 01 Jan 2006 13:30:00 -0500</pubDate>
				<guid>http://swem.wm.edu/blogs/waynegraham/index.cfm/2006/1/1/Stub-Generator-for-ModelGlue</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Model-Glue Documentor</title>
				<link>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/10/4/ModelGlue-Documentor</link>
				<description>
				
				I&apos;ve been doing a lot of XSL the last couple of weeks and thought that I&apos;d do something that could be helpful to others. Everyone likes pretty documentation, so I wrote an XSL transformation that documents the modelglue.xml file. As a disclaimer, this is development code, use it at your own risk.

With that out of the way, this is sample output from running the XSL against the &lt;a href=&quot;http://swem.wm.edu/blogs/waynegraham/examples/ModelGlue.htm&quot;&gt;contact manager sample&lt;/a&gt;. I also added a couple of tags that the stylesheet will parse: &amp;lt;projectName&amp;gt; and &amp;lt;projectDescription&amp;gt;. These tags add some metadata to the project to let you give a brief description of the project that gets displayed &lt;a href=&quot;http://swem.wm.edu/blogs/waynegraham/examples/mg.htm&quot;&gt;at the top of the page&lt;/a&gt;.

There are a couple of different ways to use this stylesheet. You can add a stylesheet reference in your modelglue.xml file like so:

&lt;div class=&quot;code&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;?xml-stylesheet href=&lt;FONT COLOR=BLUE&gt;&quot;&lt;A TARGET=&quot;_blank&quot; HREF=&quot;http://swem.wm.edu/blogs/waynegraham/examples/modelglue.xsl&quot;&gt;http://swem.wm.edu/blogs/waynegraham/examples/modelglue.xsl&lt;/A&gt;&quot;&lt;/FONT&gt; ?&amp;gt;&lt;/div&gt;

Or, if you have an XSL parser, you can just point to the XSL and let Saxon (or whatever you&apos;re using) process the file. 

I added the CSS and XSL files in a file &lt;a href=&quot;http://swem.wm.edu/blogs/waynegraham/software/mgDoc.zip&quot;&gt;for download&lt;/a&gt; if you&apos;re interested. The XSL assumes that your CSS is located in the ModelGlue folder, so if you want to put it somewhere else, you&apos;ll need to edit the transformation (line 20 in modelglue.xsl). 

I&apos;m not 100% happy with how everything is rendering yet, so if you have any suggestions, let me know.
				
				</description>
						
				
				<category>ColdFusion</category>				
				
				<category>modelglue</category>				
				
				<pubDate>Tue, 04 Oct 2005 16:28:00 -0500</pubDate>
				<guid>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/10/4/ModelGlue-Documentor</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>oXygen Template for Model-Glue 1.0</title>
				<link>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/9/28/oXygen-Template-for-ModelGlue-10</link>
				<description>
				
				I was writing some XML templates today in oXygen, and since Model-Glue 1.0 was released today, I decided to make one for model-glue. If you use &lt;a href=&quot;http://www.oxygenxml.com&quot;&gt;&amp;lt;oXygen/&amp;gt;&lt;/a&gt; (a really great XML editor by the way that also has an &lt;a href=&quot;http://www.eclipse.org&quot;&gt;Eclipse&lt;/a&gt; plugin), you can use the template by clicking on &lt;strong&gt;File --&amp;gt; New From Templates...&lt;/strong&gt; (in Eclipse, &lt;strong&gt;File --&amp;gt; New --&amp;gt; New From Templates...&lt;/strong&gt;)

You should get the templates dialog box (you have to name your file in Eclipse first), but click on the &lt;strong&gt;From URL&lt;/strong&gt; and type in 

&lt;div class=&quot;code&quot;&gt;&lt;A TARGET=&quot;_blank&quot; HREF=&quot;http://swem.wm.edu/ns/modelglue/templates.xml&quot;&gt;http://swem.wm.edu/ns/modelglue/templates.xml&lt;/A&gt;&lt;/div&gt;

and click on the Load button. You should see a new new Model-Glue 1.0 template. Click OK.

The template adds a couple of things, and assumes that you have extracted the modelglue.dtd file into /ModelGlue. I added an XML declaration and a public DOCTYPE declaration an entity reference for appName. 

Anyway, if you use &amp;lt;oXygen/&amp;gt; as your XML editor, this can save you a little time.
				
				</description>
						
				
				<category>ColdFusion</category>				
				
				<category>modelglue</category>				
				
				<category>XML</category>				
				
				<pubDate>Wed, 28 Sep 2005 15:51:00 -0500</pubDate>
				<guid>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/9/28/oXygen-Template-for-ModelGlue-10</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>DTDs, Schemas, and RelaxNG</title>
				<link>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/8/2/model-glue-dtds</link>
				<description>
				
				Last week &lt;a href=&quot;http://www.web-relevant.com/blogs/cfobjective/index.cfm?mode=entry&amp;entry=67A813F9-BDB9-5320-E8044B128FD07875&quot;&gt;Jared released a DTD for modelglue&lt;/a&gt;. This is a more traditional version of a DTD (there&apos;s no XML declaration); Andy Jarrett also released &lt;a href=&quot;http://andyjarrett.co.uk/andy/blog/index.cfm/2005/6/ModelGlue-xml-DTD&quot;&gt;a DTD that was XML compliant&lt;/a&gt; for 0.8.5. I know there are some others floating around out there, but I&apos;ve actually used these two, so please don&apos;t be offended if I didn&apos;t mention your version.

With that said, I thought I would jump into the mix with some competing code.

I&apos;ve been wanting to do something with RelaxNG for a while now. RelaxNG is a new-ish (the specification&apos;s working draft was approved in 2003) schema language that is based on &lt;a href=&quot;http://www.thaiopensource.com/trex/&quot;&gt;TREX&lt;/a&gt; (tree regular expressions for XML) and &lt;a href=&quot;http://www.xml.gr.jp/relax/&quot;&gt;RELAX&lt;/a&gt; (regular language description for XML) that boasts that it is simple, easy to learn, and has both an XML and non-XML syntax (&lt;a href=&quot;http://www.relaxng.org/#introduction&quot;&gt;among others&lt;/a&gt;).

Anyway, I started playing around with Jared&apos;s DTD as a starting point. I first created an &lt;a href=&quot;http://swem.wm.edu/ns/modelglue/0.9/modelglue.dtd&quot;&gt;XML version&lt;/a&gt; of the DTD. Essentially, the only difference is that there&apos;s an XML declaration at the top of the file. 

From this, I generated an &lt;a href=&quot;http://swem.wm.edu/ns/modelglue/0.9/modelglue.xsd&quot;&gt;XML 
schema&lt;/a&gt;. Without getting too deep into the whole DTD v. schema, the difference is that there is more (some say better) support for datatypes in schemas. 

One of the nice things my XML editor does (&lt;a href=&quot;http://www.oxygenxml.com/&quot;&gt;oXygen&lt;/a&gt;), is create models of what you&apos;re developing. Just to show the schema, I posted it &lt;a href=&quot;http://swem.wm.edu/ns/modelglue/0.9/images/modelglue-xsd.png&quot;&gt;here&lt;/a&gt;. oXygen also generates documentation for schemas which I also &lt;a href=&quot;http://swem.wm.edu/ns/modelglue/0.9/documentation.htm&quot;&gt;put up&lt;/a&gt;. 

If you&apos;ve ever looked at an XSD, you&apos;ll notice it&apos;s not a very expressive language, and not every readable (both promised with XML). This is where RelaxNG starts to outshine schemas. 

The full RelaxNG version of modelglue can be found &lt;a 
href=&quot;http://swem.wm.edu/ns/modelglue/0.9/modelglue.rng&quot;&gt;here&lt;/a&gt;. I personally find it a bit more readable in the way it defines an element, then gives it attributes that are optional (or required), and telling you that zeroOrMore (or oneOrMore) elements are required in a block. It also has a nice documentation element in &amp;lt;a:documentation&amp;gt; to actually tell what you&apos;re looking at. 

RelaxNG also has a &lt;a href=&quot;http://swem.wm.edu/ns/modelglue/0.9/modelglue.rnc&quot;&gt;compact form&lt;/a&gt; that is not XML based. It actually looks a lot like a DTD. The really cool thing is that its more than half the size of the full RelaxNG, and yet still does the exact same thing!

As far as usage, you can take your pick from the following:

&lt;div class=&quot;code&quot;&gt;&lt;FONT COLOR=GRAY&gt;&lt;I&gt;&amp;lt;!-- XML DTD --&amp;gt;&lt;/I&gt;&lt;/FONT&gt;&lt;br&gt;
&lt;FONT COLOR=NAVY&gt;&amp;lt;!DOCTYPE modelglue SYSTEM &lt;FONT COLOR=BLUE&gt;&quot;&lt;A TARGET=&quot;_blank&quot; HREF=&quot;http://swem.wm.edu/ns/modelglue/0.9/modelglue.dtd&quot;&gt;http://swem.wm.edu/ns/modelglue/0.9/modelglue.dtd&lt;/A&gt;&quot;&lt;/FONT&gt;&amp;gt;&lt;/FONT&gt;&lt;/div&gt;

&lt;div class=&quot;code&quot;&gt;&lt;FONT COLOR=GRAY&gt;&lt;I&gt;&amp;lt;!-- XML Schema --&amp;gt;&lt;/I&gt;&lt;/FONT&gt;&lt;br&gt;
&lt;FONT COLOR=NAVY&gt;&amp;lt;!DOCTYPE modelglue SYSTEM &lt;FONT COLOR=BLUE&gt;&quot;&lt;A TARGET=&quot;_blank&quot; HREF=&quot;http://swem.wm.edu/ns/modelglue/0.9/modelglue.xsd&quot;&gt;http://swem.wm.edu/ns/modelglue/0.9/modelglue.xsd&lt;/A&gt;&quot;&lt;/FONT&gt;&amp;gt;&lt;/FONT&gt;&lt;/div&gt;

&lt;div class=&quot;code&quot;&gt;&lt;FONT COLOR=GRAY&gt;&lt;I&gt;&amp;lt;!-- RelaxNG (XML) --&amp;gt;&lt;/I&gt;&lt;/FONT&gt;&lt;br&gt;
&lt;FONT COLOR=NAVY&gt;&amp;lt;!DOCTYPE modelglue SYSTEM &lt;FONT COLOR=BLUE&gt;&quot;&lt;A TARGET=&quot;_blank&quot; HREF=&quot;http://swem.wm.edu/ns/modelglue/0.9/modelglue.rng&quot;&gt;http://swem.wm.edu/ns/modelglue/0.9/modelglue.rng&lt;/A&gt;&quot;&lt;/FONT&gt;&amp;gt;&lt;/FONT&gt;&lt;/div&gt;

&lt;div class=&quot;code&quot;&gt;&lt;FONT COLOR=GRAY&gt;&lt;I&gt;&amp;lt;!-- RelaxNG (compact) --&amp;gt;&lt;/I&gt;&lt;/FONT&gt;&lt;br&gt;
&lt;FONT COLOR=NAVY&gt;&amp;lt;!DOCTYPE modelglue SYSTEM &lt;FONT COLOR=BLUE&gt;&quot;&lt;A TARGET=&quot;_blank&quot; HREF=&quot;http://swem.wm.edu/ns/modelglue/0.9/modelglue.rnc&quot;&gt;http://swem.wm.edu/ns/modelglue/0.9/modelglue.rnc&lt;/A&gt;&quot;&lt;/FONT&gt;&amp;gt;&lt;/FONT&gt;&lt;/div&gt;

Anyway, these are not &quot;official&quot; DTDs or schemas for modelglue. However, they are timesavers if you need to add things to your modelglue.xml file. 

The next two things I want to look at when I have some time are DTD/schema for config beans in the current release and ANT tasks that build the template from the SVN source.
				
				</description>
						
				
				<category>ColdFusion</category>				
				
				<category>modelglue</category>				
				
				<category>XML</category>				
				
				<pubDate>Tue, 02 Aug 2005 16:35:00 -0500</pubDate>
				<guid>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/8/2/model-glue-dtds</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Model-Glue Entities</title>
				<link>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/7/21/model-glue-entities</link>
				<description>
				
				This morning Ray asked a question on the model-glue list about reusing portions of the XML file throughout the document. Basically, since he was typing &quot;cflib2005&quot; a lot, he wanted to replace all of those instances with &quot;@applicationMapping.&quot;

I posted a solution using entity parameters, which does exactly what Ray needed. One of the really great things about XML is that it&apos;s infinitely extensible, and entities are just one such way in which to do this. Without getting too far into XML generation, you can override anything in a DTD/Schema with your own preferences by including local and external entities, notations, attlists, datatypes, etc. in the DOCTYPE declaration of an XML file.

As an example, I&apos;ll walk through using entity references in the stockquote example from the model-glue download.

In the case of model-glue, there&apos;s not an &quot;official&quot; URI for the DTD/Schema, so creating the DOCTYPE declaration in the modelglue.xml file consists of 

&lt;code&gt;
&lt;!DOCTYPE modelglue&gt;
&lt;/code&gt;

This simply declares that the following XML document had a root element of . Next, we need to add a local entity declaration for our application name, folder name, and server mapping.

&lt;code&gt;
&lt;!DOCTYPE modelglue [
   &lt;!ENTITY appName &quot;StockQuote&quot;&gt;
   &lt;!ENTITY mapping &quot;/modelgluesamples&quot;&gt;
   &lt;!ENTITY folder &quot;stockquote&quot;&gt;
]&gt;
&lt;/code&gt;

To reference this code, we do a little refactoring of the rest of the document. In the controller section, we now have

&lt;code&gt;
&lt;config&gt;
	&lt;setting name=&quot;defaultEvent&quot; value=&quot;&amp;appName;&quot; /&gt;
	&lt;setting name=&quot;applicationMapping&quot; value=&quot;&amp;mapping;/&amp;folder;&quot; /&gt;
	&lt;setting name=&quot;beanMappings&quot; value=&quot;&amp;mapping;/&amp;folder;/config/beans/&quot; /&gt;
	&lt;setting name=&quot;viewMappings&quot; value=&quot;&amp;mapping;/&amp;folder;/views&quot; /&gt;
	&lt;setting name=&quot;reload&quot; value=&quot;false&quot; /&gt;
	&lt;setting name=&quot;reloadKey&quot; value=&quot;init&quot; /&gt;
	&lt;setting name=&quot;reloadPassword&quot; value=&quot;true&quot; /&gt;
	&lt;setting name=&quot;statePrecedence&quot; value=&quot;Form&quot; /&gt;
	&lt;setting name=&quot;eventValue&quot; value=&quot;event&quot; /&gt;
	&lt;setting name=&quot;modelGlueMapping&quot; value=&quot;/ModelGlue&quot; /&gt;
	&lt;setting name=&quot;defaultExceptionHandler&quot; value=&quot;Exception&quot; /&gt;
	&lt;setting name=&quot;debug&quot; value=&quot;true&quot; /&gt;
	&lt;setting name=&quot;defaultCacheTimeout&quot; value=&quot;5&quot; /&gt;
&lt;/config&gt;
&lt;/code&gt;

Basically, these entities create variables that can be accessed throughout your XML file. However, there may be instances where you want to share this type of data among applications and use an external entity to handle some of the code.

As an example, we create a new folder under the /modelgluesamples directory called /templates. In templates, we create a folder named /stockquote. 

&lt;code&gt;
/modelgluesamples
	+
	+--/stockquote
	+--/templates
		+
		+-- stockquote
&lt;/code&gt;   

We&apos;ll create three XML files, create config.xml in /modelgluesamples/templates, and controller.xml and event-handler.xml in /modelgluesamples/templates/stockquote.

In config.xml, paste this code: 

&lt;code&gt;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;event-handlers&gt;
	&lt;event-handler name=&quot;Home&quot;&gt;
		&lt;results&gt;
			&lt;result do=&quot;Layout&quot; /&gt;
		&lt;/results&gt;
	&lt;/event-handler&gt;
	
	&lt;event-handler name=&quot;&amp;hello;&quot;&gt;
		&lt;broadcasts&gt;
			&lt;message name=&quot;DoHelloWorld&quot; /&gt;
		&lt;/broadcasts&gt;
		&lt;views&gt;
			&amp;lt;include name=&quot;content&quot; template=&quot;dsp.helloworld.cfm&quot;&gt;
				&lt;value name=&quot;greeting&quot; value=&quot;I am the default greeting.&quot; /&gt;
			&lt;/include&gt;
		&lt;/views&gt;
		&lt;results&gt;
			&lt;result do=&quot;Layout&quot; /&gt;
		&lt;/results&gt;
	&lt;/event-handler&gt;
	
	&lt;event-handler name=&quot;&amp;appName;&quot;&gt;
		&lt;broadcasts&gt;
			&lt;message name=&quot;DoStockQuote&quot;&gt;
				&lt;argument name=&quot;DefaultSymbol&quot; value=&quot;MACR&quot; /&gt;
			&lt;/message&gt;
		&lt;/broadcasts&gt;
		&lt;views&gt;
			&amp;lt;include name=&quot;content&quot; template=&quot;form.&amp;folder;.cfm&quot; /&gt;
		&lt;/views&gt;
		&lt;results&gt;
			&lt;result name=&quot;BadSymbol&quot; do=&quot;BadStockSymbol&quot; /&gt;
			&lt;result do=&quot;Layout&quot; /&gt;
		&lt;/results&gt;
	&lt;/event-handler&gt;
	
	&lt;event-handler name=&quot;BadStockSymbol&quot; access=&quot;private&quot;&gt;
		&lt;views&gt;
			&amp;lt;include name=&quot;content&quot; template=&quot;dsp.badStocksymbol.cfm&quot; /&gt;
		&lt;/views&gt;
	&lt;/event-handler&gt;
	
	&lt;event-handler name=&quot;Layout&quot; access=&quot;private&quot;&gt;
		&lt;views&gt;
			&amp;lt;include name=&quot;main&quot; template=&quot;layout.main.cfm&quot; /&gt;
		&lt;/views&gt;
	&lt;/event-handler&gt;
	
	&lt;event-handler name=&quot;Exception&quot;&gt;
		&lt;views&gt;
			&amp;lt;include name=&quot;body&quot; template=&quot;exception.cfm&quot; /&gt;
		&lt;/views&gt;
	&lt;/event-handler&gt;
&lt;/event-handlers&gt;
&lt;/code&gt;

As you see, we&apos;ve broken up the main application configuration file up into three separate files that are then included through their entity names.

I am not advocating any types of changes to model-glue, just a couple of examples of different approaches that are available. 

You can see a live example at &lt;a href=&quot;http://swem.wm.edu/modelgluesamples/stockquote&quot;&gt;http://swem.wm.edu/modelgluesamples/stockquote/&lt;/a&gt; and download the source at &lt;a href=&quot;http://swem.wm.edu/downloads/mg-entityExample.zip&quot;&gt;http://swem.wm.edu/downloads/mg-entityExample.zip&lt;/a&gt;.
				
				</description>
						
				
				<category>ColdFusion</category>				
				
				<category>modelglue</category>				
				
				<category>XML</category>				
				
				<pubDate>Thu, 21 Jul 2005 12:42:00 -0500</pubDate>
				<guid>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/7/21/model-glue-entities</guid>
				
			</item>
			
		 	
			</channel></rss>