diff options
Diffstat (limited to 'akregator/src/librss/article.cpp')
-rw-r--r-- | akregator/src/librss/article.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/akregator/src/librss/article.cpp b/akregator/src/librss/article.cpp index 18522fe3..88d42a7d 100644 --- a/akregator/src/librss/article.cpp +++ b/akregator/src/librss/article.cpp @@ -92,13 +92,16 @@ Article::Article(const TQDomNode &node, Format format, Version version) : d(new d->link = elemText; } + // prefer content/content:encoded over summary/description for feeds that provide it + if (format == AtomFeed) + { + d->description = extractNode(node, TQString::fromLatin1("content"), false); + } + else + { + d->description = extractElementTextNS(node, ContentNamespace, TQString::fromLatin1("encoded"), false); + } - // prefer content/content:encoded over summary/description for feeds that provide it - TQString tagName=(format==AtomFeed)? TQString::fromLatin1("content"): TQString::fromLatin1("content:encoded"); - - if (!(elemText = extractNode(node, tagName, false)).isNull()) - d->description = elemText; - if (d->description.isEmpty()) { if (!(elemText = extractNode(node, TQString::fromLatin1("body"), false)).isNull()) @@ -130,7 +133,7 @@ Article::Article(const TQDomNode &node, Format format, Version version) : d(new time = KRFCDate::parseDate(elemText); } - if (!(elemText = extractNode(node, TQString::fromLatin1("dc:date"))).isNull()) + if (!(elemText = extractElementTextNS(node, DublinCoreNamespace, TQString::fromLatin1("date"))).isNull()) { time = parseISO8601Date(elemText); } @@ -139,27 +142,22 @@ Article::Article(const TQDomNode &node, Format format, Version version) : d(new if (time != 0) d->pubDate.setTime_t(time); - if (!(elemText = extractNode(node, TQString::fromLatin1("wfw:comment"))).isNull()) { - d->commentsLink = elemText; - } - - if (!(elemText = extractNode(node, TQString::fromLatin1("slash:comments"))).isNull()) { - d->numComments = elemText.toInt(); - } + d->commentsLink = extractElementTextNS(node, CommentAPINamespace, TQString::fromLatin1("comment")); + d->numComments = extractElementTextNS(node, SlashNamespace, TQString::fromLatin1("comments")).toInt(); TQDomElement element = TQDomNode(node).toElement(); // in RSS 1.0, we use <item about> attribute as ID // FIXME: pass format version instead of checking for attribute - if (!element.isNull() && element.hasAttribute(TQString::fromLatin1("rdf:about"))) + if (!element.isNull() && element.hasAttributeNS(RDFNamespace, TQString::fromLatin1("about"))) { - d->guid = element.attribute(TQString::fromLatin1("rdf:about")); // HACK: using ns properly did not work + d->guid = element.attributeNS(RDFNamespace, TQString::fromLatin1("about"), TQString::null); d->guidIsPermaLink = false; } else { - tagName=(format==AtomFeed)? TQString::fromLatin1("id"): TQString::fromLatin1("guid"); + TQString tagName=(format==AtomFeed)? TQString::fromLatin1("id"): TQString::fromLatin1("guid"); TQDomNode n = node.namedItem(tagName); if (!n.isNull()) { |