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

Yahoo Weather RSS Feed - XML Help

Guest
Aug 22, 2006 Aug 22, 2006

Copy link to clipboard

Copied

I am not terribly saavy with XML parsing and am trying to format a simple RSS feed from Yahoo! Weather.
The problem I am having is with the 3 namespaces: yweather:condition and the two yweather:forecast nodes. I know how to print out all the other parts of the XML but when it comes to the namespaces I don't understand how to access their attributes.

For the other items in the XML document I am using: xmlfile.rss.channel.item.description.xmltext which is simple enough.

Can someone please tell me how to access the attributes of the yweather nodes?

Thanks in advance!


Here is a short version of the XML below:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<rss version="2.0" xmlns:yweather=" http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo=" http://www.w3.org/2003/01/geo/wgs84_pos#">
<channel>
<item>


<yweather:condition text="Fair" code="34" temp="67" date="Tue, 22 Aug 2006 10:36 am CDT" />
<yweather:forecast day="Tue" date="22 Aug 2006" low="61" high="79" text="Sunny" code="32" />
<yweather:forecast day="Wed" date="23 Aug 2006" low="64" high="80" text="Scattered Thunderstorms" code="38" />
</item>
</channel>
</rss>

TOPICS
Advanced techniques

Views

650

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

correct answers 1 Correct answer

Deleted User
Aug 23, 2006 Aug 23, 2006
Worked like a charm, thank you much!

Votes

Translate

Translate
Contributor ,
Aug 22, 2006 Aug 22, 2006

Copy link to clipboard

Copied

I think you're looking for somehting like this:

StructFind(xmlfile.rss.channel.item.yweather:condition.XmlAttributes,"text")

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
Guest
Aug 22, 2006 Aug 22, 2006

Copy link to clipboard

Copied

The solution provided above generates the error below. Any further assistance is greatly appreciated.

Thanks in advance!

Missing argument name.
When using named parameters to a function, every parameter must have a name.

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
Contributor ,
Aug 23, 2006 Aug 23, 2006

Copy link to clipboard

Copied

I think the colon in the element name is causing problems with CF (I got the same error).

I tried it by referring to the array element, and it did work.

#StructFind(mydoc.rss.channel.XMLChildren[11].XmlAttributes,"sunrise")#

Try that.

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
Guest
Aug 23, 2006 Aug 23, 2006

Copy link to clipboard

Copied

Worked like a charm, thank you much!

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
Guest
Aug 23, 2006 Aug 23, 2006

Copy link to clipboard

Copied

LATEST
Worked like a charm, thank you much!

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