...

View Full Version : number/pound sign in XML through dynamic ColdFusion?



loki421
06-29-2009, 09:04 PM
Hi all,

I am trying to deeplink to a state in my Flex application using a dynamic output from CF.

Here's what i'm trying to do, i have a ColdFusion script that takes my database items and turns them into XML



<cfquery name="qGetList" datasource="#dsn#">
select *
from myTable
where xmlOutput = 'true'
</cfquery>

<cfset tempxml = "<?xml version =""1.0""?>
<STOCK>
">

<cfloop query="qGetList">
<cfset tempxml = "#tempxml#
<ITEM>
<COLUMN1>#Trim("#XMLFormat(myColumnName1)#")#</COLUMN1>
<COLUMN2>#Trim("#XMLFormat(myColumnName2)#")#</COLUMN2>
<COLUMN3>#Trim("#XMLFormat(commercial)#")#</COLUMN3>
<DEEPLINK>http://localhost:8500/mySite-debug/index.html#view=13;column1=#Trim("#XMLFormat(myColumnName1)#")#;column2=#Trim("#XMLFormat(myColumnName2)#")#;column3=#Trim("#XMLFormat(myColumnName3)#")#</DEEPLINK>
</ITEM>
">
</cfloop>
<cfset tempxml = "#tempxml#
</STOCK>">

<cfoutput>
<xmp>
#tempxml#
</xmp>
</cfoutput>

<cfset writePath=#ExpandPath("myXMLlist.xml")#>
<cfoutput>
#writePath#<br />
<cffile action = "Write" file="#writePath#" output="#tempxml#">
</cfoutput>


The problem comes at the end of: localhost:8500/mySite-debug/index.html#view=13 where the pound/number symbol at the end of the 'index.html' (highlighted in red), so CF is going to think it's the start of a dynamic output from the db, i've tried using & # 3 5 ; (without the spaces :p) too, but again this contains a # sign, so i've tried looking for an answer for an XML symbol code for # but i'm not having much joy :(

Does anyone know if i can use the # sign in dynamic XML output coz i kinda need it for my Flex browser fragment :confused:

Really at a loss here...

Many thanks in advance all! :p


(edited for spelling lol)

Apostropartheid
06-29-2009, 11:52 PM
Not that I know of. Isn't there an escape character in CF? Usually it is a backslash.

loki421
06-30-2009, 12:24 AM
Yes there is, found it about ten mins ago! lol

I've used:



<cfset poundSign = "##" >


Then in the link where i wanted then pound/number sign to display i used:



http://www.........index.html#poundSign#views=13.....etc


Worked a treat :D

Thanks anyway, was going to post the answer tonight too! lol

Anyway, hope this helps someone, cheers :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum