Although CFML isn't valid XML it is very easy to modify it so that it
becomes valid XML.
<cfset foo = Now() > becomes <cfset expression="foo = Now()">
<cfif a eq b> becomes <cfif expression="a eq b">
<cfif a eq b>
Do This
<cfelse>
Do That
</cfif>
becomes
<cfif a eq b>
Do This
<cfelse>
</cfelse>
</cfif>
Once you've performed that manipulation you can run the document through
your XML tool of choice and as long as you reverse the operation before
running the code it all works.
We plan to do this in CFEclipse so that we can use a schema to validate
the psuedo CFML document.
It'll all happen quietly in the background, so no need to worry about it
rewriting your code ;)
Spike
Barney Boisvert wrote:
One point that should be made is that CFML is not XML, no matter how
it's written. CFELSE, CFSET and CFRETURN are three examples of tags
that simply cannot be valid XML. If you use a subset of CFML, you
could make for a valid XML document, but you'd be crippled.
This is one interesting feature of recent versions of JSP. JSP
documents are valid XML, so you can do some neat things with XSLT and
such to actually manipulate the code of you app, not just the data it
manages.
cheers,
barneyb
On 7/28/05, Spike <[EMAIL PROTECTED]> wrote:
I write code that way because it is required when writing XML and valid
XHTML. It's simpler for my poor old brain to remember to always do it
that way than to do it one way in most tag based languages and another
in ColdFusion.
It also makes code more readable for me because it is a more declarative
style.
If I see this:
<cfhttp url="blah">
There may or may not be a </cfhttp> somewhere further down the page,
whereas if I see this:
<cfhttp url="blah" />
I know there isn't one.
Spike
--
--------------------------------------------
Stephen Milligan
Code poet for hire
http://www.spike.org.uk
Do you cfeclipse? http://cfeclipse.tigris.org
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of the
email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]