FeedData.link

2 views
Skip to first unread message

Teriaki

unread,
Jan 28, 2007, 3:38:01 PM1/28/07
to ActionScript 3 Syndication Library
I thought I'd point out that the link property of
com.adobe.xml.syndication.atom.FeedData does not function as it should
per the Atom standard. Currently, it works fine when only one
atom:link is present, but produces incorrect data when more are
present.

according to http://www.atomenabled.org/developers/syndication/atom-
format-spec.php
> # atom:feed elements SHOULD contain one atom:link element with a rel attribute value of "self". This is the preferred URI for retrieving Atom Feed Documents representing this Atom feed.
> # atom:feed elements MUST NOT contain more than one atom:link element with a rel attribute value of "alternate" that has the same combination of type and hreflang attribute values.
> # atom:feed elements MAY contain additional atom:link elements beyond those described above.


Here is my simple workaround, taken directly from the
com.adobe.xml.syndication.atom.Entry (which functions correctly)

function getLinks( nfe:NewsFeedElement ):Array
{
var links:Array = new Array();
var i:XML;
for each (i in nfe.xml.atom::link)
{
var link:Link = new Link();
link.rel = ParsingTools.nullCheck(i.@rel);
link.type = ParsingTools.nullCheck(i.@type);
link.hreflang = ParsingTools.nullCheck(i.@hreflang);
link.href = ParsingTools.nullCheck(i.@href);
link.title = ParsingTools.nullCheck(i.@title);
link.length = ParsingTools.nanCheck(i.@["length"]);
links.push(link);
}
return links;
}

Reply all
Reply to author
Forward
0 new messages