Saturday, March 17, 2007

as3syndicationlib and ATOM feeds

This needs review, but for anyone else reading Atom feeds using the as3syndicationlib, you may have found that feeds with no content tag for an entry, but with the summary tag, don't process correctly. I.e., feeds that use summary and not content don't get processed as intended.

As a quick fix, I modified Entry.as in src.com.adobe.xml.syndication.atom below the comment block at line 194.

I'm still working on this, and so this code needs work. It's not the prettiest, but it's a start. Please note that indentations didn't make it from eclipse to blogger.

/*
*JDR -- Changed assignment to content.
* Also, detect for or tag usage. Blogger uses summary tag, but feedburner et.al. use content tag.
* I'm also loading the same source for XHTML or not, since ATOM feeds with XHTML I tested
* don't have the x.atom::content.xhtml::div contained.
* And, type="html" is causing >>if (content.type == "xhtml") to valuate true in the debug session.
*
*
*/
public function get content():Content
{
var content:Content = new Content();
content.type = ParsingTools.nullCheck(x.atom::content.@type);
content.src = ParsingTools.nullCheck(x.atom::content.@src);
if (content.type == "xhtml")
{
// this line needs to be changed, but for now, return flat content.
content.value = ParsingTools.nullCheck(x.atom::content);
}
else
{
content.value = ParsingTools.nullCheck(x.atom::content);
}
if(content.src != null || content.value == null)
{
content.type = ParsingTools.nullCheck(x.atom::summary.@type);
content.src = ParsingTools.nullCheck(x.atom::link.(@rel=="self").@href);
if (content.type == "xhtml")
{
content.value = ParsingTools.nullCheck(x.atom::summary);
}
else
{
content.value = ParsingTools.nullCheck(x.atom::summary);
}
}
return content;
}


See here for more info on Atom.

No comments:

Post a Comment