I'm trying to use the ideas / examples in Steve Nelson's excellent rssFeed tutorial to modify a Flash movie used to display a daily news digest. As you can probably guess, I'm not having a lot of success.

Until now, the issue has been returned as an XML file with this format
<issue>
<copy>
the contents of the entire issue, with apostrophes, quotes, HTML tags, etc.
</copy>
</issue>

and I was able to feed it to the text display quite simply, with this line:

        txtNews.text = xmlReceiver.firstChild.firstChild;

where xmlReceiver is
        var xmlReceiver:XML = new XML();
called like so
        xmlReceiver.load( "http://"; + host + "feed_xml_story.php");
and the assignment to txtNews is made in the xmlReceiver.onLoad = function(success:Boolean) event / success function.

Now we want clickable headlines, so it's no longer a simple procedure of "grab everything and dump it". I need an array of headlines and a corresponding array of news stories. When the headline is clicked, the news story will be loaded into the adjacent text area.

To avoid two trips to the database, one to fetch headlines, the other to get the stories, I decided a more complex XML stream would be returned by the script, which has this structure:

<issue>
<copy>
   <head>
        a headline, including <b> and <br> tags, properly closed
   </head>
   <story>
the associated story, 200 words or better, with apostrophes, quotes, equal signs, HTML tags, etc., in which the tags are properly closed.
   </story>
   // and there may be 10 ~ 15 head - story combinations
</copy>
</issue>

I've tried both the XPath and the recursive function approaches. They do not throw any errors, BUT don't return anything.

I tried:
        trace("XPath.selectNodes:" + XPath.selectNodes(this, "//head"))
thinking it would return all of the headlines - but nothing.

And also:
        trace(extractContent (this, "head")
with c.nodeType != 3 and also with c.nodeType = 3, thinking it would do return headlines, but it returns null. I can watch extractContent() in the debugger, and it's finding things like <br>.

Other attempts have been made, replacing "this" with "xmlReceiver", "xmlReceiver.firstChild", or "xmlReceiver.firstChild.firstChild".

My dark suspicion is that each regards the HTML tags as new XML fields, so nothing gets returned. The XML stream was originally decided on because it could contain everything, returning the story contents to a variable, as one would with LoadVars, tripped over junk contained in the stories, especially equal signs.

Could this be so? Am I doomed to two trips to the server, one to fetch headlines, the other the stories?

Regards - Miles Thompson

PS I downloaded the latest version of XPath from the X Factor Studio site. /mt


_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to