A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Mind numbing node reference

  1. #1

    Mind numbing node reference

    I've just started to get into XML. I have on one of my websites, an RSS feed page. The xml document validates correctly. What I want to do, is to be able to import the data from that rss xml document and display the data in flash.

    I can import the document correctly, but the thing that's getting me is the node reference. This is what I had to do to get to the <item> </item> nodes of the rss xml file.

    var itemDir = this.firstChild.firstChild.firstChild.nextSibling. nextSibling.nextSibling.nextSibling.nextSibling.ne xtSibling.nextSibling.nextSibling;

    Here is the xml file...

    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <?xml-stylesheet type="text/xsl" href="http://www.jake3p0.com/data/rss/rss.xsl"?>
    <rss version="2.0">
    <channel>
    
    <title>Jake3p0 RSS Feeds</title>
    <description>RSS Feeds for Jake3p0.com</description>
    <link>http://www.jake3p0.com/data/rss/3p0Feed.xml</link>
    <copyright>Copyright 2006 Jake3p0</copyright>
    <language>en-us</language>
    <lastBuildDate>Sat, 27 May 2006 14:14:00 GMT</lastBuildDate>
    <generator>Jake3p0.com RSS Feeder</generator>
    <category>Articles</category>
    
    <item>
    	<title>First attempt at RSS Feed</title>
    	<description>This is an RSS feed test.  It will self-destruct in 10 seconds ...forgive me, but I have no idea what to write.  
    	This RSS page will probably have only one entry for the next ten years.  But hey, that's just the way it is.  This 
    	is a test site which is meant to be a testing ground for all these new "technologies" such as RSS feeds and AJAX (which 
    	apparently isn't a technology, but a coagulation of Javascripting and XML technologies).</description>
    	<link>http://www.jake3p0.com/data/rss/3p0Feed.xml</link>
    	<guid isPermaLink="false">feed1</guid>
    	<pubDate>Mon, 22 May 2006 14:46:00 GMT</pubDate>
    	<author>[email protected] (Jake Mitchell)</author>
    </item>
    <item>
    	<title>Second Feed for Syndication</title>
    	<description>Apparently Syndic8.com needs to see a 2nd post for it to syndicate my RSS feed.  That pretty much 
    	means that I'll have to do many more RSS feeds just to keep the site syndicated in the future.  Yay.</description>
    	<link>http://www.jake3p0.com/data/rss/3p0Feed.xml</link>
    	<guid isPermaLink="false">feed2</guid>
    	<pubDate>Mon, 29 May 2006 13:00:00 GMT</pubDate>
    	<author>[email protected] (Jake Mitchell)</author>
    </item>
    <item>
    	<title>Oh my God it's another RSS Feed!</title>
    	<description>If you click on the XML icon you can now subscribe using Firefox.  Hurrah!</description>
    	<link>http://www.jake3p0.com/data/rss/3p0Feed.xml</link>
    	<guid isPermaLink="false">feed3</guid>
    	<pubDate>Tue, 30 May 2006 14:37:00 GMT</pubDate>
    	<author>[email protected] (Jake Mitchell)</author>
    </item>
    <item>
    	<title>Add RSS to your reader today!</title>
    	<description>I've now changed the links on my rss feeds to link to the rss file directly...so now in Firefox you can 
    	click on the rss link in the URL bar to add this rss feed to your aggregator.  Also, the same will happen if you click 
    	on any of the links in each feed.</description>
    	<link>http://www.jake3p0.com/data/rss/3p0Feed.xml</link>
    	<guid isPermaLink="false">feed4</guid>
    	<pubDate>Wed, 31 May 2006 14:14:00 GMT</pubDate>
    	<author>[email protected] (Jake Mitchell)</author>
    </item>
    <item>
    	<title>Almost Done!</title>
    	<description>Well, I'm almost done the design of the site...damn css was giving me problems with my iFrame content,
    	but that's been solved.  It was because of a minimum width value I placed in the body element in css.  Go figure.
    	</description>
    	<link>http://www.jake3p0.com/data/rss/3p0Feed.xml</link>
    	<guid isPermaLink="false">feed5</guid>
    	<pubDate>Tue, 6 Jun 2006 11:01:00 GMT</pubDate>
    	<author>[email protected] (Jake Mitchell)</author>
    </item>
    
    </channel>
    </rss>
    I hope to god there's an easier way to reference the data I want...can anyone shed some light on me?

    Oh, and in the text editor I used the 'return' command (a.k.a Enter) to wrap my text so it can easily be edited. For future reference, if I wanted to edit the xml file, how would I parse it so that flash will recognize that there is actually no 'return' at any given point in the xml file, and when I send the info back to the server (for uploading a new part of the xml file), how do I parse it so that if I were to look directly at the xml file, it wouldn't all be on one line, and would be properly indented?
    Last edited by JakeTheSnake3.0; 06-12-2006 at 12:24 PM.
    The corners have eyes!!!

  2. #2
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    I'd be curious to see the full actionscript you are using to bust this feed. That snippet isn't enough.

  3. #3

    Hrmmm....

    Well right now I'm not on my pc at home...but I basically used a different node reference .... childNodes[i] .... it was a shorter form...not as good as binding like in xml code but oh well. It works...I'll post the code later on.
    The corners have eyes!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center