<?xml version="1.0" encoding="utf-8"?>
			
			<rss version="2.0">
			<channel>
			<title>Wayne Graham&apos;s Blog - XML</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 18:29:05 -0500</pubDate>
			<lastBuildDate>Fri, 05 Oct 2007 13:27: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>Solr Schema</title>
				<link>http://swem.wm.edu/blogs/waynegraham/index.cfm/2007/10/5/Solr-Schema</link>
				<description>
				
				If you&apos;ve ever worked on a project that involved Coldfusion&apos;s bundled version of Verity, you&apos;ve no doubt run into the issue of trying to confine your fields into the structure that Verity imposes, and those custom fields are really precious in these instances. About 6 months ago, I ran into an issue with a search project where I had about 125,000 documents to index. Since we also wanted to be able to use the indexes for some other projects, I was a bit nervous to commit almost the entire allotment of indexable objects to one collection. This launched me into writing a custom search engine and indexer using Lucene and slapping Coldfusion around the responses to do things that Verity did. However, once the projects were complete, I never really got around to making it easy to use. It does cool stuff like search across multiple collections, context highlighting, relevancy calculations, term vector calculations, &quot;did you mean&quot;, etc. Essentially everything I think all good search engines need to be able to do. Something this system lacked was an easy way to define the fields that you wanted indexed (along with a knowledge of Java to actually make the changes). 

The ability to create any number of fields to index in different ways (along with faceting) is a real strong point of Solr. Not only can you add fields and choose how that data is analyzed, you can create your own field types that process the information in your index the way you want them to be. 

This is done in the $SOLR_HOME/config/schema.xml file. The first section (&amp;lt;types&gt;) defines the types of fields that you will be using, and how Solr should process them with Lucene. If you look at some of the fieldtypes, you&apos;ll get an idea of what&apos;s possible. For instance, the fieldtype for &quot;string&quot; is an untokenized field that doesn&apos;t normalize the fields and sorts missing information last. 

&lt;code&gt;
&lt;fieldtype name=&quot;string&quot; class=&quot;solr.StrField&quot; sortMissingLast=&quot;true&quot; omitNorms=&quot;true&quot;/&gt;
&lt;/code&gt;

However, if you need a more robust fieldtype, look at the fieldtype for &quot;text&quot;. This uses a whitespace tokenizer (splits words with whitespace) and uses the stopwords defined in the stopwords.txt file. It does some other processing (filters words, converts them to lowercase, runs a porter stemmer, and then removes duplicates). This fieldtype also defines what to do when a query is passed to it (uses the same filters). This is slightly different than the defined &quot;textTight&quot; which does not perform any further analysis on the text when being queried. You&apos;ll probably find that most of these work for most instances, but if you need to, you can build your own fieldtype that has very specific indexing and query filters.

The next section contains the actual fields you want to use in the aptly named &quot;fields&quot; element. This is where you actually define the fields that will be in your index, the type of analysis to perform on the field, if it should be indexed, stored, have term vectors, or be multivalued (have multiple instances of the same field in the index). 

Let&apos;s say you&apos;re wanting to develop an indexing schema for books (hey, I work in a library). At a very basic level, you&apos;d want a field for an id, title, author, reviews, and a set of topics (or tags). Your fields element would contain something along the lines of:

&lt;code&gt;
&lt;field name=&quot;id&quot; type=&quot;string&quot; indexed=&quot;true&quot; stored=&quot;true&quot;/&gt;
&lt;field name=&quot;title&quot; type=&quot;text&quot; indexed=&quot;true&quot; stored=&quot;true&quot; termVectors=&quot;true&quot; /&gt;
&lt;field name=&quot;titleStr&quot; type=&quot;string&quot; indexed=&quot;true&quot; stored=&quot;false&quot; multiValued=&quot;true&quot;/&gt;
&lt;field name=&quot;author&quot; type=&quot;text&quot; indexed=&quot;true&quot; stored=&quot;true&quot;termVectors=&quot;true&quot; /&gt;
&lt;field name=&quot;authorStr&quot; type=&quot;string&quot; indexed=&quot;true&quot; stored=&quot;false&quot; multiValued=&quot;true&quot;/&gt;
&lt;field name=&quot;review&quot; type=&quot;text&quot; indexed=&quot;true&quot; stored=&quot;true&quot; multiValued=&quot;true&quot;/&gt;
&lt;field name=&quot;topic&quot; type=&quot;text&quot; indexed=&quot;true&quot; stored=&quot;true&quot; multiValued=&quot;true&quot; termVectors=&quot;true&quot;/&gt;
&lt;field name=&quot;topicStr&quot; type=&quot;string&quot; indexed=&quot;true&quot; stored=&quot;false&quot; multiValued=&quot;true&quot;/&gt;
&lt;/code&gt;

You&apos;ll notice that I have a couple of extra fields for title, author, and topic, these are for the faceting info and are just untokenized fields to make the calculations for facets a little more efficient.

Now, we&apos;re almost done with creating the schema. We just need to declare a unique key, default search field, and default search operator. 

&lt;code&gt;
&lt;uniqueKey&gt;id&lt;/uniqueKey&gt;
&lt;defaultSearchField&gt;title&lt;/defaultSearchField&gt;
&lt;solrQueryParser defaultOperator=&quot;OR&quot;/&gt;
&lt;/code&gt;

Remember when I made the fields with the &quot;Str&quot; suffix? We can use a really cool feature of Solr called a &quot;copyField&quot; that literally copies the information from one field to another.

&lt;code&gt;
&lt;copyField source=&quot;author&quot; dest=&quot;authorStr&quot;/&gt;
&lt;copyField source=&quot;title&quot; dest=&quot;titleStr&quot;/&gt;
&lt;copyField source=&quot;topic&quot; dest=&quot;topicStr&quot;/&gt;
&lt;/code&gt;

It&apos;s worth mentioning here that Solr indexes are not databases! While there are some similarities in the way that Solr allows you to add, update, select, store, and delete information from the index, Solr isn&apos;t an RDBMS. I&apos;ve seen a few discussions where there is some confusion as to why Solr can&apos;t do the equivalent of a stored procedure, or some other function of a database. 

Now, your index server is ready to receive documents to search against. The server, in with the above example as the schema, will expect information to be in the following format:

&lt;code&gt;
&lt;doc&gt;
	&lt;field name=&quot;id&quot;&gt;1&lt;/field&gt;
	&lt;field name=&quot;title&quot;&gt;Solr Rocks!&lt;/field&gt;
	&lt;field name=&quot;author&quot;&gt;Barr, Foo&lt;/field&gt;
	&lt;field name=&quot;review&quot;&gt;This book rocks!&lt;/field&gt;
	&lt;field name=&quot;review&quot;&gt;This book is horrible!&lt;/field&gt;
	&lt;field name=&quot;topic&quot;&gt;information retrieval systems&lt;/field&gt;
	&lt;field name=&quot;topic&quot;&gt;xml&lt;/field&gt;
	&lt;field name=&quot;topic&quot;&gt;search&lt;/field&gt;
	&lt;field name=&quot;topic&quot;&gt;apache foundation&lt;/field&gt;
&lt;/doc&gt;
&lt;/code&gt;

Next week when I get some time, I&apos;ll write about creating facet queries...
				
				</description>
						
				
				<category>Apache</category>				
				
				<category>Solr</category>				
				
				<category>ColdFusion</category>				
				
				<category>XML</category>				
				
				<pubDate>Fri, 05 Oct 2007 13:27:00 -0500</pubDate>
				<guid>http://swem.wm.edu/blogs/waynegraham/index.cfm/2007/10/5/Solr-Schema</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Real Life XSLT 2.0 transformations</title>
				<link>http://swem.wm.edu/blogs/waynegraham/index.cfm/2006/8/23/Real-Life-XSLT-20-transformations</link>
				<description>
				
				I ran into a bit of a situation that was really blowing my mind. I have a rather large XML file (around 20,000+ lines) marked up in TEI that I wanted to do some transformations on (a day book and ledger from the 1850s). Essentially the code follows the format

&lt;code&gt;
...
&lt;figure&gt;
	&lt;head&gt;Page 12&lt;/head&gt;
	&lt;graphic url=&quot;0023_p12&quot;/&gt;
&lt;/figure&gt;

&lt;fw type=&quot;header&quot; place=&quot;top-center&quot;&gt;
	&lt;name type=&quot;place&quot; key=&quot;7022220&quot;&gt;Williamsburg&lt;/name&gt;,
	&lt;date value=&quot;1850&quot;&gt;1850&lt;/date&gt;,
&lt;/fw&gt;

&lt;table&gt;
	&lt;row&gt;
		&lt;cell&gt;
			&lt;date value=&quot;1850-10-03&quot;&gt;&lt;choice&gt;&lt;abbr&gt;Oct&lt;hi rend=&quot;sup;underline&quot;&gt;r&lt;/hi&gt;&lt;/abbr&gt;&lt;expan&gt;October&lt;/expan&gt;&lt;/choice&gt; 3&lt;hi rend=&quot;sup&quot;&gt;th&lt;/hi&gt; 1850&lt;/date&gt;
		&lt;/cell&gt;
		&lt;cell&gt;
			&lt;name type=&quot;person&quot; key=&quot;griffss01&quot;&gt;Doct&lt;hi rend=&quot;sup;underline&quot;&gt;r&lt;/hi&gt; S S Griffin&lt;/name&gt;
		 &lt;/cell&gt;
		 &lt;cell&gt;&amp;nbsp;&lt;/cell&gt;
	&lt;/row&gt;
	...
&lt;/table&gt;
&lt;pb/&gt;
...
&lt;/code&gt;

What I wanted to accomplish was group all this together in separate divs for HTML output (ok, I actually need to write each page to its own file, but this is pretty much just one more step). 

I just could not find a way to group this info this way using XSLT 1 without wrapping each page within its own div structure. I didn&apos;t really want to go back and do this, so I asked the TEI-L list. David Sewell pinged me back with some XQuery code that recursively recalls the document structure for a given node. 

He also mentioned that it would be pretty easy to write an XSLT 2 transformation that groups these nodes together. I did a little bit of digging and came up with

&lt;code&gt;
&lt;xsl:template match=&quot;tei:div&quot;&gt;
	&lt;xsl:for-each-group select=&quot;*&quot; group-ending-with&quot;tei:pb&quot;&gt;
		&lt;div class=&quot;page&quot;&gt;
			 &lt;xsl:apply-templates select=&quot;current-group()&quot; /&gt;
		&lt;/div&gt;
	&lt;/xsl:for-each-group&gt;
&lt;/xsl:template&gt;
&lt;/code&gt;

This transformed the pages to what I was wanting

&lt;code&gt;
&lt;div class=&quot;page&quot;&gt;
	&lt;img src=&quot;0023_12.png&quot; alt=&quot;Page 12&quot; /&gt;
	
	&lt;h1 class=&quot;fw&quot;&gt;Williamsburg, 1850,&lt;/h1&gt;
	
	&lt;table&gt;
		&lt;tr&gt;
			&lt;td&gt;
			&lt;span class=&quot;abbr&quot;&gt;Oct&lt;sup&gt;&lt;u&gt;r&lt;/u&gt;&lt;/sup&gt;&lt;/span&gt;&lt;span class=&quot;expan&quot;&gt;October&lt;/span&gt; 3&lt;sup&gt;th&lt;/sup&gt; 1850&lt;/date&gt;
		&lt;/td&gt;
		&lt;td&gt;
			&lt;a href=&quot;javascript:getName(&apos;griffss01&apos;);&gt;Doct&lt;sup&gt;&lt;u&gt;r&lt;/u&gt;&lt;/sup&gt; S S Griffin&lt;/a&gt;
		 &lt;/td&gt;
		 &lt;td&gt;&amp;nbsp;&lt;/td&gt;
	&lt;/row&gt;
	...
&lt;/table&gt;
&lt;/div&gt;

&lt;div class=&quot;page&quot;&gt;
	...
&lt;/div&gt;
&lt;/code&gt;

The XSLT processor for ColdFusion doesn&apos;t support XSLT 2.0 (it&apos;s still a draft spec). However, Saxon does (specifically Saxon 8). For more on doing XSLT transformations, see &lt;a href=&quot;http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/11/21/XSLT-20-in-ColdFusion&quot;&gt;XSLT 2.0 in ColdFusion&lt;/a&gt;.
				
				</description>
						
				
				<category>XSLT</category>				
				
				<category>Web</category>				
				
				<category>ColdFusion</category>				
				
				<category>XML</category>				
				
				<pubDate>Wed, 23 Aug 2006 11:56:00 -0500</pubDate>
				<guid>http://swem.wm.edu/blogs/waynegraham/index.cfm/2006/8/23/Real-Life-XSLT-20-transformations</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Getting XML from MSSQL Server</title>
				<link>http://swem.wm.edu/blogs/waynegraham/index.cfm/2006/8/21/Getting-XML-from-MSSQL-Server</link>
				<description>
				
				I&apos;ve been playing with &lt;a href=&quot;http://openrico.org/&quot;&gt;all&lt;/a&gt; &lt;a href=&quot;scriptaculous&quot;&gt;the&lt;/a&gt; &lt;a href=&quot;http://labs.adobe.com/technologies/spry/&quot;&gt;AJAX&lt;/a&gt; &lt;a href=&quot;http://dojotoolkit.org/&quot;&gt;stuff&lt;/a&gt; &lt;a href=&quot;http://developer.yahoo.com/yui/&quot;&gt;that&apos;s&lt;/a&gt; &lt;a href=&quot;http://code.google.com/webtoolkit/&quot;&gt;been&lt;/a&gt; &lt;a href=&quot;http://mochikit.com/&quot;&gt;coming&lt;/a&gt; &lt;a href=&quot;http://www.aflax.org/&quot;&gt;out&lt;/a&gt; &lt;a href=&quot;http://jquery.com/&quot;&gt;lately&lt;/a&gt;. I suppose that like a lot of folks, I was creating a query, then having a generic function that created the XML in a proxy file for the JavaScript (&lt;a href=&quot;http://ray.camdenfamily.com/index.cfm/2006/7/13/ToXML-Update&quot;&gt;Ray Camden has a really nice function for transforming a query to XML&lt;/a&gt;). 

Last week I was doing some research to find a way to do some XML searching and stumbled upon the &lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/ms190922.aspx&quot;&gt;FOR XML&lt;/a&gt; statement. I knew that most RDBMSs were capable of dealing with XML record sets, but it&apos;s been years since I&apos;ve even looked at any of the XML stuff for MSSQL. 

The FOR XML statement returns a query result and transforms rows into XML elements. There are three arguments that this can take:

&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/ms175140.aspx&quot;&gt;RAW&lt;/a&gt;: Transforms each row into an element with a generic identifier (&amp;lt;row/&gt;) as the element tag.&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/ms188273.aspx&quot;&gt;AUTO&lt;/a&gt;: Returns the results in a simple nested XML tree&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/ms175140.aspx&quot;&gt;EXPLICIT&lt;/a&gt;: Allows you to define the XML tree returned&lt;/li&gt;
&lt;/ul&gt;
				 [More]
				</description>
						
				
				<category>ColdFusion</category>				
				
				<category>AJAX</category>				
				
				<category>XML</category>				
				
				<pubDate>Mon, 21 Aug 2006 11:49:00 -0500</pubDate>
				<guid>http://swem.wm.edu/blogs/waynegraham/index.cfm/2006/8/21/Getting-XML-from-MSSQL-Server</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>RSS Information Visualization</title>
				<link>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/12/15/RSS-Information-Visualization</link>
				<description>
				
				Last week I attended a lecture by Andries van Dam (Brown University&apos;s Vice President for Research) entitled Immersive Virtual Reality in Scientific Visualization. He highlighted how their &lt;a href=&quot;http://graphics.cs.brown.edu/research/cave/home.html&quot;&gt;Cave project&lt;/a&gt; was allowing geologists to explore Mars (and train astronauts for their eventual missions on the planet). He closed the presentation with a couple of tablet PC applications, one for chemistry that allows you to hand draw 3D models of molecules and the other, a math visualization program.

The math application (&lt;a href=&quot;http://www.cs.brown.edu/~jjl/mathpad/home.html&quot;&gt;MathPad&lt;sup&gt;2&lt;/sup&gt;&lt;/a&gt;) was actually a lot cooler. The premise of the software is that it&apos;s far easier to hand write complex mathematical formulas than it is to type them in (ever try to type in a calculus problem?). Not only does the software allow you to write down your problem, you can then draw pictures to simulate the mathematical formulas you wrote down. You can see an example of the difference between constant speed and velocity (along with damped harmonic oscillation) at &lt;a href=&quot;http://www.cs.brown.edu/~jjl/mathpad/MathPad_full.wmv&quot;&gt;their site&lt;/a&gt;. 

These examples got me thinking about how we visualize our data. Take a blog for example. We generally tag (or otherwise categorize) the content we author. But what exactly does that mean? I believe this is where data visualization begins to play an important role. 

When you go to a site with a tag cloud, you can quickly infer information about the content of that site. If, say, ColdFusion is denoted in a larger font in the cloud than ASP, you may conclude (even if at a subconscious level) that the site is geared more toward ColdFusion than ASP. 

There&apos;s a small (some may argue that it&apos;s actually quite significant) flaw in this data visualization...you cannot see the interaction between the different tags, nor their relation to individual postings.
				 [More]
				</description>
						
				
				<category>ColdFusion</category>				
				
				<category>XML</category>				
				
				<pubDate>Thu, 15 Dec 2005 13:46:00 -0500</pubDate>
				<guid>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/12/15/RSS-Information-Visualization</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>XSLT 2.0 in ColdFusion</title>
				<link>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/11/21/XSLT-20-in-ColdFusion</link>
				<description>
				
				While not totally on topic with this posting, but definitely worth reading is &lt;a href=&quot;http://www.talkingtree.com/blog/index.cfm/2005/11/18/XmlSearchNoNameNamespace&quot;&gt;Steven Erat&apos;s explanation of using the XMLSearch function with default namespaces&lt;/a&gt;.

XSLT 2.0 was released as its W3C Candidate Recommendation 3 earlier this month (&lt;a href=&quot;http://www.w3.org/TR/2005/CR-xslt20-20051103/&quot;&gt;http://www.w3.org/TR/2005/CR-xslt20-20051103/&lt;/a&gt;). 
There are a lot of nice new features that go along with the new specification (user functions, grouping, multiple outputs, temporary trees, character mappings, datatype bindings, etc.). And, it&apos;s relatively painless to implement in ColdFusion.

The first thing you need is an XSLT 2.0 compliant parser. Right now, that means &lt;a href=&quot;http://saxon.sourceforge.net/&quot;&gt;Saxon 8&lt;/a&gt;. You&apos;ll need to put at least the Saxon8.jar file into your Coldfusion classpath (&lt;a href=&quot;http://weblogs.macromedia.com/cantrell/archives/2004/07/the_definitive.cfm&quot;&gt;see Christian Cantrell&apos;s cheat sheet&lt;/a&gt;). 

The next part is to write a wrapper for the transformation. Because Mark Mandel already wrote a replacement for XMLTransform that allows for parameters, I used his &lt;a href=&quot;http://www.compoundtheory.com/?action=displayPost&amp;ID=4&quot;&gt;xslt function code&lt;/a&gt; as a jumping off point. Really there&apos;s only one line that has to be changed (other than renaming the function). The code line

&lt;div class=&quot;code&quot;&gt;var tFactory = createObject(&lt;FONT COLOR=BLUE&gt;&quot;java&quot;&lt;/FONT&gt;, &lt;FONT COLOR=BLUE&gt;&quot;javax.xml.transform.TransformerFactory&quot;&lt;/FONT&gt;).newInstance();&lt;/div&gt;

simply needs to be rewritten as

&lt;div class=&quot;code&quot;&gt;var tFactory = createObject(&lt;FONT COLOR=BLUE&gt;&quot;java&quot;&lt;/FONT&gt;, &lt;FONT COLOR=BLUE&gt;&quot;net.sf.saxon.TransformerFactoryImpl&quot;&lt;/FONT&gt;);&lt;/div&gt;

You can grab the function &lt;a href=&quot;http://swem.wm.edu/blogs/waynegraham/software/cfxslt2.zip&quot;&gt;here&lt;/a&gt;.

So, now a quick example of the power of XSLT 2.0...

Let&apos;s say you have an XML file that lists cities in the US with their state and populations:

&lt;div class=&quot;code&quot;&gt;&amp;lt;?xml version=&lt;FONT COLOR=BLUE&gt;&quot;1.0&quot;&lt;/FONT&gt; encoding=&lt;FONT COLOR=BLUE&gt;&quot;UTF-8&quot;&lt;/FONT&gt;?&amp;gt;&lt;br&gt;
&lt;FONT COLOR=NAVY&gt;&amp;lt;cities&amp;gt;&lt;/FONT&gt;&lt;br&gt;
    &lt;FONT COLOR=NAVY&gt;&amp;lt;city name=&lt;FONT COLOR=BLUE&gt;&quot;Williamsburg&quot;&lt;/FONT&gt; state=&lt;FONT COLOR=BLUE&gt;&quot;Virginia&quot;&lt;/FONT&gt; pop=&lt;FONT COLOR=BLUE&gt;&quot;11998&quot;&lt;/FONT&gt; /&amp;gt;&lt;/FONT&gt;&lt;br&gt;
    &lt;FONT COLOR=NAVY&gt;&amp;lt;city name=&lt;FONT COLOR=BLUE&gt;&quot;New York City&quot;&lt;/FONT&gt; state=&lt;FONT COLOR=BLUE&gt;&quot;New York&quot;&lt;/FONT&gt; pop=&lt;FONT COLOR=BLUE&gt;&quot;80000&quot;&lt;/FONT&gt; /&amp;gt;&lt;/FONT&gt;&lt;br&gt;
    &lt;FONT COLOR=NAVY&gt;&amp;lt;city name=&lt;FONT COLOR=BLUE&gt;&quot;Washington&quot;&lt;/FONT&gt; state=&lt;FONT COLOR=BLUE&gt;&quot;DC&quot;&lt;/FONT&gt; pop=&lt;FONT COLOR=BLUE&gt;&quot;553523&quot;&lt;/FONT&gt; /&amp;gt;&lt;/FONT&gt;&lt;br&gt;
    &lt;FONT COLOR=NAVY&gt;&amp;lt;city name=&lt;FONT COLOR=BLUE&gt;&quot;Richmond&quot;&lt;/FONT&gt; state=&lt;FONT COLOR=BLUE&gt;&quot;Virginia&quot;&lt;/FONT&gt; pop=&lt;FONT COLOR=BLUE&gt;&quot;300000&quot;&lt;/FONT&gt; /&amp;gt;&lt;/FONT&gt;&lt;br&gt;
&lt;FONT COLOR=NAVY&gt;&amp;lt;/cities&amp;gt;&lt;/FONT&gt;&lt;/div&gt;

Now, you want to display cities grouped by state and output the state&apos;s total population. 

In XSLT 1.0, you needed to rely on XPath queries with nested for loops:

&lt;div class=&quot;code&quot;&gt;&amp;lt;?xml version=&lt;FONT COLOR=BLUE&gt;&quot;1.0&quot;&lt;/FONT&gt; encoding=&lt;FONT COLOR=BLUE&gt;&quot;UTF-8&quot;&lt;/FONT&gt;?&amp;gt;&lt;br&gt;
&lt;FONT COLOR=NAVY&gt;&amp;lt;xsl:stylesheet xmlns:xsl=&lt;FONT COLOR=BLUE&gt;&quot;&lt;A TARGET=&quot;_blank&quot; HREF=&quot;http://www.w3.org/1999/XSL/Transform&quot;&gt;http://www.w3.org/1999/XSL/Transform&lt;/A&gt;&quot;&lt;/FONT&gt; version=&lt;FONT COLOR=BLUE&gt;&quot;2.0&quot;&lt;/FONT&gt;&amp;gt;&lt;/FONT&gt;&lt;br&gt;
    &lt;FONT COLOR=NAVY&gt;&amp;lt;xsl:template match=&lt;FONT COLOR=BLUE&gt;&quot;/&quot;&lt;/FONT&gt;&amp;gt;&lt;/FONT&gt;&lt;br&gt;
        &lt;FONT COLOR=TEAL&gt;&amp;lt;table&amp;gt;&lt;/FONT&gt;&lt;br&gt;
            &lt;FONT COLOR=NAVY&gt;&amp;lt;xsl:for-each select=&lt;FONT COLOR=BLUE&gt;&quot;cities/city[not(@state=preceding::*/@state)]&quot;&lt;/FONT&gt;&amp;gt;&lt;/FONT&gt;&lt;br&gt;
                &lt;FONT COLOR=TEAL&gt;&amp;lt;tr&amp;gt;&lt;/FONT&gt;&lt;br&gt;
                    &lt;FONT COLOR=TEAL&gt;&amp;lt;td&amp;gt;&lt;/FONT&gt;&lt;FONT COLOR=NAVY&gt;&amp;lt;xsl:value-of select=&lt;FONT COLOR=BLUE&gt;&quot;@state&quot;&lt;/FONT&gt; /&amp;gt;&lt;/FONT&gt;&lt;FONT COLOR=TEAL&gt;&amp;lt;/td&amp;gt;&lt;/FONT&gt;&lt;br&gt;
                    &lt;FONT COLOR=TEAL&gt;&amp;lt;td&amp;gt;&lt;/FONT&gt;&lt;br&gt;
                        &lt;FONT COLOR=NAVY&gt;&amp;lt;xsl:for-each select=&lt;FONT COLOR=BLUE&gt;&quot;../city[@state = current()/@state]&quot;&lt;/FONT&gt;&amp;gt;&lt;/FONT&gt;&lt;br&gt;
                            &lt;FONT COLOR=NAVY&gt;&amp;lt;xsl:value-of select=&lt;FONT COLOR=BLUE&gt;&quot;@name&quot;&lt;/FONT&gt;/&amp;gt;&lt;/FONT&gt;&lt;br&gt;
                            &lt;FONT COLOR=NAVY&gt;&amp;lt;xsl:if test=&lt;FONT COLOR=BLUE&gt;&quot;position() != last()&quot;&lt;/FONT&gt;&amp;gt;&lt;/FONT&gt;, &lt;FONT COLOR=NAVY&gt;&amp;lt;/xsl:if&amp;gt;&lt;/FONT&gt;&lt;br&gt;
                        &lt;FONT COLOR=NAVY&gt;&amp;lt;/xsl:for-each&amp;gt;&lt;/FONT&gt;&lt;br&gt;
                    &lt;FONT COLOR=TEAL&gt;&amp;lt;/td&amp;gt;&lt;/FONT&gt;&lt;br&gt;
                    &lt;FONT COLOR=TEAL&gt;&amp;lt;td&amp;gt;&lt;/FONT&gt;&lt;br&gt;
                        &lt;FONT COLOR=NAVY&gt;&amp;lt;xsl:value-of select=&lt;FONT COLOR=BLUE&gt;&quot;sum(../city[@state=current()/@state]/@pop)&quot;&lt;/FONT&gt; /&amp;gt;&lt;/FONT&gt;&lt;br&gt;
                    &lt;FONT COLOR=TEAL&gt;&amp;lt;/td&amp;gt;&lt;/FONT&gt;&lt;br&gt;
                &lt;FONT COLOR=TEAL&gt;&amp;lt;/tr&amp;gt;&lt;/FONT&gt;&lt;br&gt;
            &lt;FONT COLOR=NAVY&gt;&amp;lt;/xsl:for-each&amp;gt;&lt;/FONT&gt;&lt;br&gt;
        &lt;FONT COLOR=TEAL&gt;&amp;lt;/table&amp;gt;&lt;/FONT&gt;&lt;br&gt;
        &lt;FONT COLOR=NAVY&gt;&amp;lt;/xsl:template&amp;gt;&lt;/FONT&gt;&lt;br&gt;
&lt;FONT COLOR=NAVY&gt;&amp;lt;/xsl:stylesheet&amp;gt;&lt;/FONT&gt;&lt;/div&gt;

However, in XSLT 2.0, the for-each-group function makes this same transformation much more straight forward:

&lt;div class=&quot;code&quot;&gt;&amp;lt;?xml version=&lt;FONT COLOR=BLUE&gt;&quot;1.0&quot;&lt;/FONT&gt; encoding=&lt;FONT COLOR=BLUE&gt;&quot;UTF-8&quot;&lt;/FONT&gt;?&amp;gt;&lt;br&gt;
&lt;FONT COLOR=NAVY&gt;&amp;lt;xsl:stylesheet xmlns:xsl=&lt;FONT COLOR=BLUE&gt;&quot;&lt;A TARGET=&quot;_blank&quot; HREF=&quot;http://www.w3.org/1999/XSL/Transform&quot;&gt;http://www.w3.org/1999/XSL/Transform&lt;/A&gt;&quot;&lt;/FONT&gt; version=&lt;FONT COLOR=BLUE&gt;&quot;2.0&quot;&lt;/FONT&gt;&amp;gt;&lt;/FONT&gt;&lt;br&gt;
     &lt;FONT COLOR=NAVY&gt;&amp;lt;xsl:template match=&lt;FONT COLOR=BLUE&gt;&quot;/&quot;&lt;/FONT&gt;&amp;gt;&lt;/FONT&gt;&lt;br&gt;
        &lt;FONT COLOR=TEAL&gt;&amp;lt;table&amp;gt;&lt;/FONT&gt;&lt;br&gt;
            &lt;FONT COLOR=NAVY&gt;&amp;lt;xsl:for-each-group select=&lt;FONT COLOR=BLUE&gt;&quot;cities/city&quot;&lt;/FONT&gt; group-by=&lt;FONT COLOR=BLUE&gt;&quot;@state&quot;&lt;/FONT&gt;&amp;gt;&lt;/FONT&gt;&lt;br&gt;
                &lt;FONT COLOR=TEAL&gt;&amp;lt;tr&amp;gt;&lt;/FONT&gt;&lt;br&gt;
                    &lt;FONT COLOR=TEAL&gt;&amp;lt;td&amp;gt;&lt;/FONT&gt;&lt;FONT COLOR=NAVY&gt;&amp;lt;xsl:value-of select=&lt;FONT COLOR=BLUE&gt;&quot;@state&quot;&lt;/FONT&gt; /&amp;gt;&lt;/FONT&gt;&lt;FONT COLOR=TEAL&gt;&amp;lt;/td&amp;gt;&lt;/FONT&gt;&lt;br&gt;
                    &lt;FONT COLOR=TEAL&gt;&amp;lt;td&amp;gt;&lt;/FONT&gt;&lt;br&gt;
                        &lt;FONT COLOR=NAVY&gt;&amp;lt;xsl:value-of select=&lt;FONT COLOR=BLUE&gt;&quot;current-group()/@name&quot;&lt;/FONT&gt; separator=&lt;FONT COLOR=BLUE&gt;&quot;, &quot;&lt;/FONT&gt; /&amp;gt;&lt;/FONT&gt;&lt;br&gt;
                    &lt;FONT COLOR=TEAL&gt;&amp;lt;/td&amp;gt;&lt;/FONT&gt;&lt;br&gt;
                    &lt;FONT COLOR=TEAL&gt;&amp;lt;td&amp;gt;&lt;/FONT&gt;&lt;FONT COLOR=NAVY&gt;&amp;lt;xsl:value-of select=&lt;FONT COLOR=BLUE&gt;&quot;sum(current-group()/@pop)&quot;&lt;/FONT&gt; /&amp;gt;&lt;/FONT&gt;&lt;FONT COLOR=TEAL&gt;&amp;lt;/td&amp;gt;&lt;/FONT&gt;&lt;br&gt;
                &lt;FONT COLOR=TEAL&gt;&amp;lt;/tr&amp;gt;&lt;/FONT&gt;&lt;br&gt;
            &lt;FONT COLOR=NAVY&gt;&amp;lt;/xsl:for-each-group&amp;gt;&lt;/FONT&gt;&lt;br&gt;
        &lt;FONT COLOR=TEAL&gt;&amp;lt;/table&amp;gt;&lt;/FONT&gt;&lt;br&gt;
        &lt;FONT COLOR=NAVY&gt;&amp;lt;/xsl:template&amp;gt;&lt;/FONT&gt;&lt;br&gt;
&lt;FONT COLOR=NAVY&gt;&amp;lt;/xsl:stylesheet&amp;gt;&lt;/FONT&gt;&lt;/div&gt;

Notice the difference in the amount of code, and how you have to access the different attributes. The function current-group() of the complexity of accessing the current node in your transformation, making development quicker and less buggy. 

You can see the results from the above example &lt;a href=&quot;http://swem.wm.edu/blogs/waynegraham/examples/xslt2Example.cfm&quot;&gt;here&lt;/a&gt;.

This seriously only scratches the surface of what you can do with ColdFusion and XSLT 2.0. The Saxon parser also implements the XQuery 1.0 and XPath 2.0 opening a whole new set of possibilities in ColdFusion.
				
				</description>
						
				
				<category>ColdFusion</category>				
				
				<category>XML</category>				
				
				<pubDate>Mon, 21 Nov 2005 15:52:00 -0500</pubDate>
				<guid>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/11/21/XSLT-20-in-ColdFusion</guid>
				
				<enclosure url="http://swem.wm.edu/blogs/waynegraham/enclosures/cfxslt2.zip" length="786" type="application/unknown"/>
				
			</item>
			
		 	
			
			
			<item>
				<title>Default XML Namespaces and ColdFusion</title>
				<link>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/11/14/Default-XML-Namespaces-and-ColdFusion</link>
				<description>
				
				I ran into a bit of a problem late last week working with XML with ColdFusion. I was writing my XSL in oXygen which was running beautifully, but when I got to the point to move it to CF to use XMLTransform, I kept getting an error that &quot;An error occured while Transforming an XML document. Content is not allowed in prolog.&quot;

Essentially, the XmlTransform function didn&apos;t like my root node:

&lt;div class=&quot;code&quot;&gt;&lt;FONT COLOR=NAVY&gt;&amp;lt;modsCollection xmlns=&lt;FONT COLOR=BLUE&gt;&quot;&lt;A TARGET=&quot;_blank&quot; HREF=&quot;http://www.loc.gov/mods/v3&quot;&gt;http://www.loc.gov/mods/v3&lt;/A&gt;&quot;&lt;/FONT&gt;&amp;gt;&lt;/FONT&gt;&lt;/div&gt;

The funny thing to me was the fact that CF appears to use Xalan for XML parsing, which I was also using since I am using the java.net.URLEncoder. So I figured I&apos;d need to start writing a wrapper to access the Xalan package I was using. I did a little Googling and found &lt;a href=&quot;http://www.compoundtheory.com/?action=displayPost&amp;ID=4&quot;&gt;this&lt;/a&gt; over at &lt;a href=&quot;http://www.compoundtheory.com/&quot;&gt;Compound Theory&lt;/a&gt;.

The post originally is about using &lt;xsl:import&gt;, but also solved this problem as the javax packages have parsers that handle default namespace (without a prefix). It&apos;s a good read, especially if you try to do anything with more complex XML in ColdFusion.
				
				</description>
						
				
				<category>ColdFusion</category>				
				
				<category>XML</category>				
				
				<pubDate>Mon, 14 Nov 2005 10:01:00 -0500</pubDate>
				<guid>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/11/14/Default-XML-Namespaces-and-ColdFusion</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Export OPML from Thunderbird</title>
				<link>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/10/7/Export-OPML-from-Thunderbird</link>
				<description>
				
				I&apos;ve been using Thunderbird as my RSS reader for a a while now...and it does a pretty decent job. However, with the flurry of posts about the Google RSS reader, I decided to also have a look. There&apos;s an option to import your feed from other programs, but this requires OPML format.

Unfortunately, there&apos;s not an option to create this output file. After a little digging, there actually is a way to get Thunderbird to export the OPML from your aggregator. I found &lt;a href=&quot;http://dougal.gunters.org/blog/2005/01/03/thunderbird-opml&quot;&gt;this post by Dougal Campbell&lt;/a&gt; where he basically fixed the bug that hid the export/import function in the &quot;Manage Subscriptions&quot; portion.

All you need to do is exit Thunderbird and download his patched &lt;a href=&quot;http://dougal.gunters.org/docs/newsblog.jar&quot;&gt;newsblog.jar&lt;/a&gt; file. Then, go to your Thunderbird installation home (Program files\Mozilla Thunderbird\chrome) and rename newsblog.jar to something else (he recommends &apos;newsblog.jar.orig&apos;) and put the patched version in there. Now, when you start Thunderbird and go to manage your subscriptions, you will see the option to import and export OPML files. 

Then just head over to Google Reader and upload the file. It takes a little bit to upload the file (I suspect they&apos;re getting hammered pretty hard right now). You&apos;ll probably also want to remove the &quot;patched&quot; newsblog.jar and rename your newblog.jar.orig to its original name since it&apos;s not part of the normal distribution.
				
				</description>
						
				
				<category>Google</category>				
				
				<category>Web</category>				
				
				<category>XML</category>				
				
				<pubDate>Fri, 07 Oct 2005 15:29:00 -0500</pubDate>
				<guid>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/10/7/Export-OPML-from-Thunderbird</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>Atom for BlogCFC</title>
				<link>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/9/23/Atom-for-BlogCFC</link>
				<description>
				
				There are a lot of different formats for generating syndicated content (RSS 1 and 2, OPML, Atom, etc.). Currently (as of 2005), there are two big players, RSS 2.0 and Atom 1.0. One of the downfalls of the RSS 2.0 standard is that it is copyrighted by Harvard University, and work on the specificiation has halted. Because of this, future work has to be carried out under a different name (and organization). The Atompub Working Group is one organization carrying out further development of online syndication with the Atom 1.0 standard.

Without getting too far into the differences between the two, I thought one of the coolest things about Atom is that it is capable of being transferred using any network protocol (like XMPP). Atom is also an XML namespace, along with using a non-normative RelaxNG schema. 

Anyway, I extended this blog (&lt;a href=&quot;http://ray.camdenfamily.com&quot;&gt;BlogCFC&lt;/a&gt;) to generate an Atom feed (including the RSS 1.0 and RSS 2.0 feeds it already generated). The code isn&apos;t quite ready to post yet, but I basically created a new file named atom.cfm, which is almost exactly like rss.cfm, but calls a new function in blog.cfc called generateAtom. 

The generateAtom function creates the Atom XML, and includes a stylesheet from the &lt;a href=&quot;http://www.atomenabled.org&quot;&gt;AtomEnabled.org&lt;/a&gt; site. Because Atom uses the xhtml namespace, it actually uses your browser&apos;s default HTML stylesheet rather than the XML stylesheet with the tree view. 

I have validated the feed against &lt;a href=&quot;http://swem.wm.edu/blogs/waynegraham/atom.cfm?mode=full&quot;&gt;FEED Validator&lt;/a&gt;, though the enclosures and subjects aren&apos;t currently in there...but will be added shortly.
				
				</description>
						
				
				<category>Blog</category>				
				
				<category>Web</category>				
				
				<category>XML</category>				
				
				<pubDate>Fri, 23 Sep 2005 14:11:00 -0500</pubDate>
				<guid>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/9/23/Atom-for-BlogCFC</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>CF RegEx</title>
				<link>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/9/15/CF-RegEx</link>
				<description>
				
				On a few pages on our website, I&apos;m pulling data directly from an RSS feed to display on the page. However, I (ok, so it was someone else) discovered that hyperlinks don&apos;t retain an their anchor tag when pulled from the feed.

I figured this was an easy enough fix, as I can just run a RegEx on the string to replace the &quot;http://&quot; part with an anchor tag. I forgot how much a pain in the butt RegExes were!

In one of my books, I remembered seeing how to do this in PERL:

&lt;div class=&quot;code&quot;&gt;open(FILE, &lt;FONT COLOR=BLUE&gt;&quot;myfile.txt&quot;&lt;/FONT&gt;);&lt;br&gt;
&lt;br&gt;
while(&lt;FONT COLOR=FF8000&gt;&amp;lt;FILE&amp;gt;&lt;/FONT&gt;){&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(/http:/){&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;s{(http:[^s]*)} {&lt;FONT COLOR=GREEN&gt;&amp;lt;a href=&lt;FONT COLOR=BLUE&gt;&quot;$1&quot;&lt;/FONT&gt;&amp;gt;&lt;/FONT&gt;$1&lt;FONT COLOR=GREEN&gt;&amp;lt;/a&amp;gt;&lt;/FONT&gt;}gs;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print;&lt;br&gt;
}&lt;/div&gt;

So, what I did was get the feed via cfhttp and then use an XPath query to get the items, and then RegEx to replace instances of http://somewhere with &amp;lt;a href=&quot;http://somewhere&quot;&amp;gt;somwhere&amp;lt;/a&amp;gt;

As I do anytime I play with RegEx, I end up spending way more time that I had planned to actually accomplish the task. Every language implements RegEx differently, and it took me a few tries to get the back-references for the code right, but here it is:

&lt;div class=&quot;code&quot;&gt;&lt;FONT COLOR=GRAY&gt;&lt;I&gt;&amp;lt;!--- removing the actual call to the RSS file, &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;but it&apos;s a cfhttp call and an XPath to get&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;the items from the feed ---&amp;gt;&lt;/I&gt;&lt;/FONT&gt;&lt;br&gt;
     &lt;FONT COLOR=MAROON&gt;&amp;lt;cfset theText = rss.description.xmlText /&amp;gt;&lt;/FONT&gt;&lt;br&gt;
     &lt;FONT COLOR=MAROON&gt;&amp;lt;cfset theText = REReplace(theText, &lt;FONT COLOR=BLUE&gt;&quot;(http:[^\s]*)&quot;&lt;/FONT&gt;, &lt;FONT COLOR=BLUE&gt;&quot;&lt;FONT COLOR=GREEN&gt;&amp;lt;a href=&quot;&lt;/FONT&gt;&lt;FONT COLOR=BLUE&gt;&quot;\1&quot;&lt;/FONT&gt;&lt;FONT COLOR=BLUE&gt;&quot;&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;\1&lt;FONT COLOR=GREEN&gt;&amp;lt;/a&amp;gt;&lt;/FONT&gt;&quot;&lt;/FONT&gt;, &lt;FONT COLOR=BLUE&gt;&quot;all&quot;&lt;/FONT&gt;) /&amp;gt;&lt;br&gt;
     &lt;FONT COLOR=MAROON&gt;&amp;lt;cfoutput&amp;gt;&lt;/FONT&gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#paragraphFormat(theText)#&lt;br&gt;
     &lt;FONT COLOR=MAROON&gt;&amp;lt;/cfoutput&amp;gt;&lt;/FONT&gt;&lt;/div&gt;
				
				</description>
						
				
				<category>ColdFusion</category>				
				
				<category>XML</category>				
				
				<pubDate>Thu, 15 Sep 2005 16:48:00 -0500</pubDate>
				<guid>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/9/15/CF-RegEx</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>More on Entities</title>
				<link>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/7/28/sub-entities</link>
				<description>
				
				I got an interesting email yesterday about my post last week on using document type declarations (&amp;lt;!DOCTYPE&amp;gt;) with entities. Basically, they wanted to break down their structure into folders and each item becoming an entity itself. However, it just didn&apos;t work and kept erroring out. They sent me their code on what they were trying to do. 

Essentially, they had three folders inside the config folder, one for their controller, configuration, and event handlers. The ModelGlue.xml file then called each of the files based on the &lt;a href=&quot;http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/7/21/model-glue-entities&quot;&gt;examples from last week&lt;/a&gt;. 

However, they further segregated the event handler into three files:

&lt;div class=&quot;code&quot;&gt;&lt;FONT COLOR=GRAY&gt;&lt;I&gt;&amp;lt;!-- eventHandler.xml --&amp;gt;&lt;/I&gt;&lt;/FONT&gt;&lt;br&gt;
&lt;br&gt;
&lt;FONT COLOR=NAVY&gt;&amp;lt;!DOCTYPE event-handlers [&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;!ENTITY module1 &lt;FONT COLOR=BLUE&gt;&quot;mod1.xml&quot;&lt;/FONT&gt;&amp;gt;&lt;/FONT&gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;!ENTITY module2 &lt;FONT COLOR=BLUE&gt;&quot;mod2.xml&quot;&lt;/FONT&gt;&amp;gt;&lt;br&gt;
]&amp;gt;&lt;br&gt;
&lt;br&gt;
&lt;FONT COLOR=NAVY&gt;&amp;lt;event-handlers&amp;gt;&lt;/FONT&gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;module1;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;module2;&lt;br&gt;
&lt;FONT COLOR=NAVY&gt;&amp;lt;/event-handlers&amp;gt;&lt;/FONT&gt;&lt;/div&gt;

Since this file is called from within the ModelGlue.xml file in the content area, does anyone see the problem?

If you want to work on the problem, skip the rest of this...

This is an XML error. We&apos;ve got a master XML file with a document type declaration for the entire document (and there can only be one) and a second document type declaration inside causing a parsing error. So if you want to do this, how do you get around it?

If we go back to our ModelGlue.xml file, we can create the following:

&lt;div class=&quot;code&quot;&gt;&lt;FONT COLOR=NAVY&gt;&amp;lt;!DOCTYPE modelglue [&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;!ENTITY config &lt;FONT COLOR=BLUE&gt;&quot;config.xml&quot;&lt;/FONT&gt;&amp;gt;&lt;/FONT&gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;!ENTITY controller &lt;FONT COLOR=BLUE&gt;&quot;controller.xml&quot;&lt;/FONT&gt;&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;!ENTITY module1 &lt;FONT COLOR=BLUE&gt;&quot;mod1.xml&quot;&lt;/FONT&gt;&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;!ENTITY module2 &lt;FONT COLOR=BLUE&gt;&quot;mod2.xml&quot;&lt;/FONT&gt;&amp;gt;&lt;br&gt;
]&amp;gt;&lt;br&gt;
&lt;br&gt;
&lt;FONT COLOR=NAVY&gt;&amp;lt;modelglue&amp;gt;&lt;/FONT&gt;&lt;br&gt;
     &lt;B&gt;&lt;I&gt;&amp;amp;config;&lt;/I&gt;&lt;/B&gt;&lt;br&gt;
     &lt;B&gt;&lt;I&gt;&amp;amp;controller;&lt;/I&gt;&lt;/B&gt;&lt;br&gt;
     &lt;FONT COLOR=NAVY&gt;&amp;lt;event-handlers&amp;gt;&lt;/FONT&gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;module1;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;module2;&lt;br&gt;
     &lt;FONT COLOR=NAVY&gt;&amp;lt;/event-handlers&amp;gt;&lt;/FONT&gt;&lt;br&gt;
&lt;FONT COLOR=NAVY&gt;&amp;lt;/modelglue&amp;gt;&lt;/FONT&gt;&lt;/div&gt;
				
				</description>
						
				
				<category>ColdFusion</category>				
				
				<category>XML</category>				
				
				<pubDate>Thu, 28 Jul 2005 10:43:00 -0500</pubDate>
				<guid>http://swem.wm.edu/blogs/waynegraham/index.cfm/2005/7/28/sub-entities</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>