From e1c6775076354b532edccd95b8c3ad03b7a60bea Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Thu, 18 Jun 2015 17:44:03 -0600 Subject: [PATCH] Patch from Maxim Velesyuk to fix parsing CNN feed --- ChangeLog | 5 +++++ debian/changelog | 6 ++++++ main.lisp | 16 +++++++++++----- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 592ad3b..40ce4ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-09-04 Kevin Rosenberg + * Version 0.9.1 + * main.lisp: Patch from Maxim Velesyik fixing errors parsing CNN + feed. + 2012-09-04 Kevin Rosenberg * Version 0.9.0 * Commit patch from Rupert Swarbrick: Parse RSS version 2 and diff --git a/debian/changelog b/debian/changelog index d859c38..717fc26 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +cl-rss (0.9.1-1) unstable; urgency=low + + * New upstream + + -- Kevin M. Rosenberg Thu, 18 Jun 2015 17:43:36 -0600 + cl-rss (0.9.0-2) unstable; urgency=low * Switch to dpkg-source 3.0 (quilt) format diff --git a/main.lisp b/main.lisp index 44fd788..3545f93 100644 --- a/main.lisp +++ b/main.lisp @@ -111,11 +111,14 @@ was already set." throwing an error if it was already set, or if they aren't a string. Used for elements like and <link>, which shouldn't crop up twice." (let ((string (car (xmls:xmlrep-children node)))) - (unless (stringp string) - (error 'rss-parse-error - :msg (format nil "Got ~A when expecting string for contents of <~A>" - string name))) - (setf-unique-slot object name string))) + ;; skip empty nodes + (when string + (progn + (unless (stringp string) + (error 'rss-parse-error + :msg (format nil "Got ~A when expecting string for contents of <~A>" + string name))) + (setf-unique-slot object name string))))) (defun ensure-string-slots-filled (object required-slots strict?) "For each slot in REQUIRED-SLOTS, if it is unbound in OBJECT, set it to the @@ -157,6 +160,9 @@ and BODY is performed with ITEM set to the item we're modifying and NODE set to the XML node we just got." `(defun ,name (node object strict?) (declare (ignorable strict?)) + ;; skip atom-related tags + (when (equalp "http://www.w3.org/2005/Atom" (xmls:node-ns node)) + (return-from ,name nil)) (string=-case (xmls:xmlrep-tag node) (,@(mapcar (lambda (sym) `(,(symbol-to-name sym) -- 2.34.1