<cfparam name="theGreatLakesStateName" default="">
<cfparam name="theKeystoneStateName" default="">
<cfobject component="slow" name="state">
<cfset location = "">
<cffile action="read" file="#GetDirectoryFromPath(CGI.CF_TEMPLATE_PATH)#states.xml" variable="stateDataXML">
<cfif NOT isXml(stateDataXML)>
	<h1>Error</h1>
	<p>Could not interpret data</p>
	<cfabort>
<cfelse>
	<cfset stateData = xmlParse(stateDataXML)>
	<cfloop from="1" to="#arrayLen(stateData.states.state)#" index="i">
		<cfinvoke component="#state#" method="init" returnvariable="myState" />
		<cfif stateData.states.state[i].usps.xmlText EQ "MI">
			<cfset theGreatLakesStateName = stateData.states.state[i].name.xmlText>
		</cfif>
		<cfif stateData.states.state[i].usps.xmlText EQ "PA">
			<cfset theKeystoneStateName = stateData.states.state[i].name.xmlText>
		</cfif>
	</cfloop>
</cfif>

<cfoutput>
<h1>Some information about states:</h1>
<ul>
	<li>The Great Lakes State is #theGreatLakesStateName#</li>
	<li>The Keystone State is #theKeystoneStateName#</li>
</ul>
</cfoutput>