1 Reply Latest reply on Aug 29, 2009 4:14 PM by tedalde2

    Parsing Atom/XML feeds within AIR? bout to cry! pls help!

    IrishAIRMax

      Hi everyone,

       

      I am having a terrible time with this!! Just cant find any documentation on it and I dont have much experience in the field of xml and atom.

       

      I have created an AJAX Air application and now have to use atom for the blogger data api.......

       

      but i don't know how??!! been trying to find something on it the past two weeks while doing other things as well but can't find anything.........

       

      Now its got to the stage that this is the only thing left in the project but I cant find anything on it, how to do it, can Air do it??

       

      If anyone can answer any of these questions! they would be an absolute star!!!

       

      Anyone with any kind of information on this would be great! So demoralised!! Just need something to chase up or go on! Dont know what to do next or where to look or anything!

       

      Thank you all in advance! Really need some help!

      IrishAirMax

        • 1. Re: Parsing Atom/XML feeds within AIR? bout to cry! pls help!
          tedalde2 Level 2

          Here's an outline of an RSS feed parse I did a while ago. An atom feed may be more complicated, so you've got a bit of work to do. Then I assume you want to display or send the parse elsewhere for processing , so that's some more work. Good luck. Here's an outline of an RSS parse:

           

          // pass an rss xml and make objects out of its items
          protected function rssParseXML(xml:XML):Array
          {
            var ar:Array = new Array();
           
            try
            {  
             if (xml is XML)
             {
              var chan:XMLList = xml.elements("channel");
              if (chan is XMLList)
              {
               // these are the feed properties.
               var feedTitle:String = chan.elements("title").toString();
               ... and get other properties of the feed if you want
               // find all items and make objects out of them.
               var allItems:XMLList = chan.elements("item");
               if (allItems is XMLList)
               {
                var i:int, len:int = allItems.length();
                var ielmt:XML;
                for (i = 0; i < len; i++)
                {
                 ielmt = allItems[i] as XML;
                 if (ielmt is XML)
                 {
                  ... create a new object to hold all this item properties
                  obj.title = ielmt.elements("title").toString();
                  ... all the properties you want, you'll want to parse the date str, etc...
                  ar.push(obj);
                 }
                }
               }
              }
             }
            }
            catch(err)
            {
            
            }
           
            return ar;
          }