[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenetwork/librss
From:       Frerich Raabe <raabe () kde ! org>
Date:       2003-10-26 21:54:45
[Download RAW message or body]

CVS commit by raabe: 

- Fundamental support for RSS 1.0 so that the tagesschau.de feed gets recognized
- Work around weird change in QDomElement's behaviour


  M +10 -4     document.cpp   1.13
  M +2 -1      global.h   1.7


--- kdenetwork/librss/document.cpp  #1.12:1.13
@@ -96,4 +96,7 @@ Document::Document(const QDomDocument &d
                 if (attr == \
QString::fromLatin1("http://my.netscape.com/rdf/simple/0.9/"))  d->version = v0_90;
+                else if (attr == QString::fromLatin1("http://purl.org/rss/1.0/")) {
+                        d->version = v1_0;
+                }
         } else {
                 attr = \
rootNode.toElement().attribute(QString::fromLatin1("version"), QString::null); @@ \
                -115,11 +118,11 @@ Document::Document(const QDomDocument &d
          * node for <image>, <textinput> and <item> than RSS 0.91 and 0.92.
          */
-        QDomNode parentNode, n;
-        if (d->version == v0_90)
+        QDomNode parentNode;
+        if (d->version == v0_90 || d->version == v1_0)
                 parentNode = rootNode;
         else
                 parentNode = channelNode;
 
-        n = parentNode.namedItem(QString::fromLatin1("image"));
+        QDomNode n = parentNode.namedItem(QString::fromLatin1("image"));
         if (!n.isNull())
                 d->image = m_factory->createImage(n);
@@ -130,7 +133,9 @@ Document::Document(const QDomDocument &d
 
         // Our (hopefully faster) version of elementsByTagName()
-        for (QDomElement e = parentNode.firstChild().toElement(); !e.isNull(); e = \
e.nextSibling().toElement()) +        for (n = parentNode.firstChild(); !n.isNull(); \
n = n.nextSibling()) { +                const QDomElement e = n.toElement();
                 if (e.tagName() == QString::fromLatin1("item"))
                         d->articles.append(m_factory->createArticle(e));
+        }
 
         if (!(elemText = extractNode(channelNode, \
QString::fromLatin1("copyright"))).isNull()) @@ -404,4 +409,5 @@ QString \
Document::verbVersion() const  case v0_90: return QString::fromLatin1("0.90");
                 case v0_91: return QString::fromLatin1("0.91");
+                case v1_0: return QString::fromLatin1("1.0");
         }
         return QString::null;

--- kdenetwork/librss/global.h  #1.6:1.7
@@ -25,5 +25,6 @@ namespace RSS
         enum Version {
                 v0_90,    /// RSS v0.90
-                v0_91     /// RSS v0.91
+                v0_91,    /// RSS v0.91
+                v1_0      /// RSS v1.0
         };
         


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic