Bug 105895 - Doesn't support XHTML in Blogger feeds
Summary: Doesn't support XHTML in Blogger feeds
Status: RESOLVED FIXED
Alias: None
Product: akregator
Classification: Applications
Component: general (show other bugs)
Version: 1.0.2
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-18 17:15 UTC by Patrick McFarland (Diablo-D3)
Modified: 2005-06-29 01:01 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick McFarland (Diablo-D3) 2005-05-18 17:15:39 UTC
Version:           1.0.2 (using KDE KDE 3.4.0)
Installed from:    Debian testing/unstable Packages

Akregator does not properly parse the style of XHTML used by Blogger, and breaks the formatting (mainly, the lack of parsing of <BR />) on all several thousand blogs hosted by Blogger.
Comment 1 Eckhart Wörner 2005-05-18 17:19:04 UTC
Example: http://shadowconflict.blogspot.com/atom.xml

Confirmed for KDE 3.4 and SVN HEAD.
Comment 2 Heinrich Wendel 2005-06-29 01:01:55 UTC
SVN commit 429812 by lanius:

support for mode element in atom feeds
BUG: 105895

 M  +1 -0      addfeeddialog.cpp  
 M  +16 -1     librss/tools_p.cpp  
 M  +1 -0      librss/tools_p.h  


--- trunk/KDE/kdepim/akregator/src/addfeeddialog.cpp #429811:429812
@@ -36,6 +36,7 @@
 #include <kdebug.h>
 #include <ksqueezedtextlabel.h>
 #include <kmessagebox.h>
+#include <kurl.h>
 
 using namespace Akregator;
 
--- trunk/KDE/kdepim/akregator/src/librss/tools_p.cpp #429811:429812
@@ -28,6 +28,15 @@
         return KRFCDate::parseDateISO8601(s + "T12:00:00");
 }
 
+QString RSS::childNodesAsXML(const QDomNode& parent)
+{
+	QDomNodeList list = parent.childNodes();
+	QString str;
+	QTextStream ts( &str, IO_WriteOnly );
+	for (uint i = 0; i < list.count(); ++i)
+		ts << list.item(i);
+	return str.stripWhiteSpace();
+}
 
 QString RSS::extractNode(const QDomNode &parent, const QString &elemName, bool isInlined)
 {
@@ -35,8 +44,14 @@
 	if (node.isNull())
 		return QString::null;
 
-	QString result = node.toElement().text();
+	QDomElement e = node.toElement();
+	QString result;
 
+	if (elemName == "content" && ((e.hasAttribute("mode") && e.attribute("mode") == "xml") || !e.hasAttribute("mode")))
+		result = childNodesAsXML(node);
+	else
+		result = e.text();
+
 	bool hasPre = result.contains("<pre>",false);
 	bool hasHtml = hasPre || result.contains("<");	// FIXME: test if we have html, should be more clever -> regexp
 	if(!isInlined && !hasHtml)						// perform nl2br if not a inline elt and it has no html elts
--- trunk/KDE/kdepim/akregator/src/librss/tools_p.h #429811:429812
@@ -28,6 +28,7 @@
 
 	QString extractNode(const QDomNode &parent, const QString &elemName, bool isInlined=true);
 	QString extractTitle(const QDomNode &parent);
+	QString childNodesAsXML(const QDomNode& parent);
 	time_t parseISO8601Date(const QString &s);
 }