This should work fine (if slowly) asside from the fact that you need
to add xmlformat() around the attribute and text node values.

> If it helps, I wrote a little UDF for this...can't
> guarantee it'll be
> 100% on all of the time, I scrawled it out quickly for my
> own quick
> use a while back.

> <cffunction name="prettyXml" returnType="string"
> output="false">
>       <cfargument name="xmlNode">
>       <cfargument name="depth" default="0">

>       <cfset var result = "" />

>       <cfset result = repeatString(chr(9), arguments.depth) &
> "<#arguments.xmlNode.xmlName#" />

>       <cfloop collection="#arguments.xmlNode.xmlAttributes#"
>       item="i">
>               <cfset result = result & "
>               #i#=""#arguments.xmlNode.xmlAttributes[i]#""">
>       </cfloop>

>       <cfif not len(arguments.xmlNode.xmlText) and not
> arrayLen(arguments.xmlNode.xmlChildren)>
>               <cfset result = result & " /">
>       </cfif>

>       <cfset result = result & ">" />
>       <cfif len(trim(arguments.xmlNode.xmlText))>
>               <cfset result = result & chr(10) & repeatString(chr(9),
> arguments.depth + 1) &
> htmlEditFormat(arguments.xmlNode.xmlText) &
> chr(10) />
>       <cfelse>
>               <cfset result = result & chr(10) />
>       </cfif>

>       <cfloop from="1"
>       to="#arrayLen(arguments.xmlNode.xmlChildren)#" index="i">
>               <cfset result = result &
>               prettyXml(arguments.xmlNode.xmlChildren[i],
> arguments.depth + 1) />
>       </cfloop>

>       <cfif len(arguments.xmlNode.xmlText) or
> arrayLen(arguments.xmlNode.xmlChildren)>
>               <cfset result = result & repeatString(chr(9),
>               arguments.depth) &
> "</#arguments.xmlNode.xmlName#>" & chr(10) />
>       </cfif>

>       <cfreturn result />
> </cffunction>



s. isaac dealey   954.522.6080
new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework

http://www.fusiontap.com
http://coldfusion.sys-con.com/author/4806Dealey.htm




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:207562
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to