Link to home
Start Free TrialLog in
Avatar of jfill89
jfill89

asked on

Trying to access Node with variable in Xml

I am trying to put a variable into some code that is being used to access a node in an Xml Doc. Below is what I am trying but I keep getting an error. I am not sure how to make it work.

<cfset bestPrice[2] = "#XmlRateSheet.investor.products.#ProductCode#.rates.ratesdata[4].exp2.XmlText#">

As you can see above #ProductCode# is the variable that needs to be introduced in this code as a variable. Any thoughts on how I can work around this? The error is below.

Thanks,

jfill


A CFML variable name cannot end with a "." character.
The variable XmlRateSheet.investor.products. ends with a "." character. You must supply an additional structure key or delete the "." character.
The CFML compiler was processing
ASKER CERTIFIED SOLUTION
Avatar of hart
hart
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jfill89
jfill89

ASKER

Hart,

I am getting the same error when I try
<cfset bestPrice[2] = Evaluate("XmlRateSheet.investor.products.#ProductCode#.rates.ratesdata[4].exp2.XmlText")>

jfill
Avatar of jfill89

ASKER

Ok I got it figured out.

<cfset bestPrice[2] = Evaluate("XmlRateSheet.investor.products." & "#ProductCode#" & ".rates.ratesdata[4].exp2.XmlText")>

That seems to do the trick.

jfill