I wrote this little UDF a couple years back to pretty-print XML.

http://www.barneyb.com/barneyblog/2008/05/01/indentxml-cf-udf/

<cfoutput>
<pre>#htmlEditFormat(indentXml(xmlStringToFormat))#<pre>
</cfoutput>

On Fri, Mar 5, 2010 at 10:20 PM, Brad Wood <[email protected]> wrote:
>
>> ToString(XmlParse(xmlString))
>
> This is redunant.  You just turned a string into an object, and back into a
> string again.
>
>> XmlFormat(ToString(XmlParse(xmlString)))
>
> 5 yard penalty for misuse of the xmlFormat function.  That function is
> designed to make a string safe for inclusion in an XML document without
> being confused with the XML markup of the document it is being included in.
>
> Try this:
>
> <pre>
>    #xmlString#
> </pre>
>
> If you want more control, htmlEditFormat it, and manually replace line
> breaks with <br>, spaces with &nbsp; and tabs with
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; etc...
>
> ~Brad
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331406
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to