• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Escaping the : character

New Here ,
Aug 25, 2006 Aug 25, 2006

Copy link to clipboard

Copied

Hi

How do you escape the : character on the line below from an rss feed from yahoo weather ?

#XMLContent.rss.channel.item.yweather:condition.text.xmlText#

I have tried

/:
#:
['yweather:condition']

but I am still getting the error

Invalid CFML construct found on line 41 at column 39.
ColdFusion was looking at the following text:
:
TOPICS
Advanced techniques

Views

536

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 25, 2006 Aug 25, 2006

Copy link to clipboard

Copied

Use array notation!

#XMLContent.rss.channel.item["yweather:condition"].text.xmlText#

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 25, 2006 Aug 25, 2006

Copy link to clipboard

Copied

Thanks that seems to have solved that problem but has resulted in me getting another CF error

I am using

#XMLContent.rss.channel.item["yweather:forecast day"].xmlText#

based on item elements from
http://developer.yahoo.com/weather/#item

I am getting the CF error
Error Occurred While Processing Request
Element yweather:forecast day is undefined in a Java object of type class coldfusion.xml.XmlNodeList referenced as

41 : #XMLContent.rss.channel.item["yweather:forecast day"].xmlText#
42 :
43 : </cfoutput>

Is my RSS syntax incorrect?


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 25, 2006 Aug 25, 2006

Copy link to clipboard

Copied

Have you parsed your xml yet? If not use xmlParse(), if you have dump XMLContent and look at the structure!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 25, 2006 Aug 25, 2006

Copy link to clipboard

Copied

Yes I have, and have dumped the results

The problem I have is how do you display the element attributes ? this is what is causing me the error

the forecast part of the xml doc has attributes such as code, date, day, high, low etc....

How could I add the 'day' attribute which is an attribute of 'forecast' for example to the line below

#XMLContent.rss.channel.item["yweather:forecast"].xmlText#

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 25, 2006 Aug 25, 2006

Copy link to clipboard

Copied

LATEST
XMLContent.rss.channel.item["yweather:forecast"].xmlAttributes.day

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation