Solved

Trying to access Node with variable in Xml

Posted on 2004-10-07
3
198 Views
Last Modified: 2013-12-24
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
0
Comment
Question by:jfill89
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
hart earned 125 total points
ID: 12249588
try evaluate
<cfset bestPrice[2] = Evaluate("XmlRateSheet.investor.products.#ProductCode#.rates.ratesdata[4].exp2.XmlText")>

Regards
Hart
0
 
LVL 1

Author Comment

by:jfill89
ID: 12249645
Hart,

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

jfill
0
 
LVL 1

Author Comment

by:jfill89
ID: 12249715
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
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now