I'm currently working in order to catch some online datas via an RSS feed. I use a Socket connection for this, which is working fine.

For example, here is the kind of datas I get in the RSS (it's a weather feed):
Code: Select all
<?xml version = "1.0" encoding="UTF-8" standalone="yes"?>
<rss version="2.0" xmlns:meteo="http://www.meteorologic.net/rss/1.0">
<channel><item>
<meteo:weather date="26 Avril" tempe_matin="10.4" namepictos_matin="Dégagé" pictos_matin="soleil" tempe_midi="18" namepictos_midi="Dégagé" pictos_midi="soleil" tempe_apmidi="21" namepictos_apmidi="Dégagé" pictos_apmidi="soleil" tempe_soir="16.4" namepictos_soir="Dégagé" pictos_soir="soleil" />
</item></channel></rss>
Let's assume I'm interested in getting the values into "tempe_matin". My code looks like this:
Code: Select all
// Creating an XML object from the String "xmlFinalString" got via Socket
try
{
var rss = new XML (xmlFinalString);
} catch(e) {
alert ("Impossible de formater les données recueillies en balises XML.\r " + e.toString());
break;
}
var ns = new Namespace ("meteo:weather");
var tempmatin = rss.ns[1].@tempe_matin.toString(); // Here ExtendScript crashes
alert (tempmatin);

Could someone explain me my mistake(s) and how to extract a determined string from my XML object?
Thanks a lot for your help,
Julien
PS : Although my English may not be perfect, I hope it remains understandable
