ColdFusion & XML

<cfxml variable="students">
        <name>John Barrett</name>
        <school>University of Hawaii</school>
        <department>New Media</department>
<cffile action="write"
<!--- dump results--->
<cfdump var="#students#">

This produces the file students.xml in the same directory, with the following results

<?xml version="1.0" encoding="UTF-8"?>
        <name>John Barrett</name>
        <school>University of Hawaii</school>
        <department>New Media</department>

Now the next is where I am strgugling, I would like to have a form, that will update this file.

an example form would be

<!--- Simple JavaScript Sample --->
<script language="javascript">
    function checkFields(frm) {
        alert('Dear ' + + ', This validation occurred after the CF validation.');

<!--- Basic ColdFusion Form --->
<p>All Fields are required!</p>
<cfform action="form_action.cfm" method="post" name="myForm" onSubmit="return checkFields(document.myForm)">

<table width="200" border="1">
    <td><cfinput type="text" name="name" size="20" required="true" message="You must enter your name!" /></td>
    <td><cfinput type="text" name="school" size="20" required="true" message="You must enter your school!" /></td>
    <td><cfinput type="text" name="department" size="20" required="true" message="You must enter your department!" /></td>

    <cfinput type="submit" name="submit" value="submit" />

Now I would like to take the form fields are update the students.xml file.

First beofre I can update the file with cffile I need to figure out:

* reading the XML data with ColdFusion
* finding the last node
* creating new nodes with the new data


I would really like to thanks @Clarkee21 on twitter for all his help tonight!

Looked on the CF Docs page, and I could not find an example to help complete this.

so using the XmlElemNew function should update the file. So I tried this tonight

<cffile action="read" file="#expandPath('./students.xml')#" variable="xmldoc">
<cfset mydoc = XmlParse(xmldoc)>
<cfdump var="#mydoc#">

This reads the current xml doc students.xml and dumps the results

now to write to a file in ColdFusion you use cffile =”write” and there is a parameter for output, which will write that data there. Now there is no need to re write the whole file, just want to add a new entry in the form

        <name>new student</name>
        <school>new school</school>
        <department>new dept</department>

the above is just dumy code, but you get the point.

In the past I have alway used cfquery to write the data to the database, and then create a file to convert the database records to a XML file. The CF Docs had a great example for this.

However, when looking to just simple updating the XML, I can’t seem to find one code example for Help. I alsays asked in CF Talk, and asked on the Adobe Foum, but no luck. Thanks to twitter looks like I will get some Help, thanks to @charlie21, and to Ray Camden!

It is so late here, and I need to get to sleep, but I think that the CF Docs should provide a good example on how to do something as basic as updating the XML like this.

Somebody at work should be a way in php in just a few lines. I love CF, and I always want to do things in CF. I must be missing something here, as it can’t be this difficult!

I would say to adobe that a good example that somebody can onto the docs and find an example to do this would be a good idea.

This is the first example that I have experienced using ColdFusion, where using CF didn’t turn something that was hard in other languages and made it trivial. comes to mind! this tags makes working with the database so easy, as in other languages it is difficult.

FDT on Linux

So on Twitter tonight there was talk on the fact that FDT works in Linux. Are you kidding me, is this real, WOW!

Why the excitement, I HATE WINDOWS! and at the place I work there is only a Linux box that I use for the development of the projects. Therefore I carry my macBook in from home, but since I have a bad back from an old surfing accident, I would prefer not to have to carry the Mac around with me.

I really like Linux, and we have set up a ColdFusion development machine there as well, this is where I do all the testing for the work projects. The one complaint I have is there has not been up to date any decent way of writing actionscript 3.0 or Flex code on Linux.

Now that I hear that there is a way to get FDT running on Linux, I am very excited,and this will the the first thing I will be doing at work in the morning! Stay tune for part two of this blog post, where I will let you know how I got FDT running in Ubuntu. I am stoked!

AS 3 Must Visit Events

Using Twitter?
If you are and you are a Flasher Myself(@hfug) and Marvin from Beautify Code(@beautifycode) has started a hash tag series on twitter.

The idea is simple, which Marvin deserves Full Credit, he just thought of a calendar which shows every Actionscript- Event/Conference/Meeting worth visiting in 2010. Whenever you know anything you can simply post it via Twitter! and we’ll add it (later surely automatically) to the calendar. The more people adding dates the more events will become well visited. So don’t shy to tweet !

For example the Latest Hawaii Flash User Group Meeting is on the calendar and you can mention it on twitter this way
Adobe mobileMax 1/27/10 Honolulu, Hawaii #as3mustvisit

You can view the Calendar at

Besides we’ve got following ideas for that:

  • As WordPress Plugin
  • Widget
  • “Upcoming events””shown as list for month
  • Filtering

FDT Meeting is Tonight

The meeting on Setting up a Flash Development Envirnoment using FDT is tonight at 6:00 PM!

For more informatio about the Event with Michael Plank, please view the Adobe Groups Site for the Hawaii Flash User Group

The meeting will start with me given a brief overview on FDT, and then Michael will demostrate using FDT, and will go over the new features in FDT 3.5 Beta 2.

Also, be sure to enter the contest to wn a free licence for FDT, see detials

FDT Goes Hawaii

The Next meeting at the Hawaii Flash User Group will be on “Setting up a flash development environment with FDT”

This talk will feature Micheal Plank who is a technology evangelist and software developer at Powerflasher, Germany’s largest multimedia agency specialising in Flash.

Michael has been hooked on creating interactive applications with Flash since version 4.

If you are coding in ActionScript 3.0, I am sure that you have heard of FDT, or the Flash Development Tool, which is a plugin for the Eclipse editor,  meant to speed up
your actioscript development time.

FDT brings many high level development features, such as

  • Code Templates
  • Quick Fixes
  • Organize Imports
  • Code Formating
  • Code Completion
  • Refactoring (rename and move)
  • AS Docs
  • AS 3

Will try to  cover everything from setting up the environment, and learning about Eclipse and ANT. Then will be discussing setting up a Flash Project in FDT, and building a project from the ground up.

Afterwards, the discussion will be  how to set up a work-flow between FDT and the Flash IDE! The point is you use the Flash IDE for designing, but you code in FDT!
There will FDT stickers & brochures to give away (thanks for Bruno Fonzi)

Eventhough this is an introduction to using FDT most of the discussion will be on using the features of FDT, and not too much details on Eclipse or ANT.
If you have any questions about installing FDT or ANT, please contact me.

This is an Event Not to be Missed!

Come see why FDT is the Best editor for your actionscript development!
Please go to the Adobe Groups site and RSVP for the Event!

This meeting will be live in case you are not in Honolulu, and all are welcome to attend! The event will be held at 6:00 pm Hawaii Time, and the connect room is at:

Help spread the word!

Also, check out the post on the FDT blog:

There will also be a Special surprise at the Meeting too`-`

Follow on twitter hfug #FDT goes #Hawaii