<cfcomponent accessor="true">
<cfproperty name="name" />
<cfproperty name="model" />
<cfproperty name="make" />
<cffunction name="BuildCarXML" output="false">
<cfsavecontent variable="local.xmlCar">
<cfoutput><?xml version="1.0" encoding="UTF-8" ?>
<car>
<name>#variables.name#</name>
</car></cfoutput>
</cfsavecontent>
<cfreturn xmlCar />
</cffunction>
</cfcomponent>
Finally, u call this function from a cfm page:
<cfscript>
cfcCar = new Car();
cfcCar.setName("AU");
writeDump(cfcCar.BuildCarXML());
</cfscript>