?
Solved

Trying to access Node with variable in Xml

Posted on 2004-10-07
3
Medium Priority
?
204 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
hart earned 375 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

762 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