bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#34685: 26.1; function nnrss-get-namespace-prefix always returns nil


From: Noam Postavsky
Subject: bug#34685: 26.1; function nnrss-get-namespace-prefix always returns nil
Date: Thu, 04 Apr 2019 20:50:54 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.91 (gnu/linux)

tags 34685 + moreinfo
quit

wenbushi <wenbushi@gmail.com> writes:

> The function "nnrss-get-namespace-prefix" in gnus/nnrss.el always
> returns nil, which causes the contents in "<content:encoded>" tag of
> an RSS XML not showing in the gnus article buffer.
>
> Here is a fix:
>
> --- nnrss.el    2019-02-28 20:02:29.224675750 +0800
> +++ nnrss-fixed.el      2019-02-28 20:02:04.534267796 +0800
> @@ -1031,7 +1031,7 @@
>    "Given EL (containing a parsed element) and URI (containing a string
>  that gives the URI for which you want to retrieve the namespace
>  prefix), return the prefix."
> -  (let* ((prefix (car (rassoc uri (cadar el))))
> +  (let* ((prefix (car (rassoc uri (cadar (nthcdr 2 (car el))))))

> the argument "el" in the function is a list of the parsed XML, like(some
> fields are ignored)
>
> ((rss ((version . "2.0") (xmlns:atom . "http://www.w3.org/2005/Atom";))
>       (channel ((xmlns:content . "http://purl.org/rss/1.0/modules/content/";))
>                (title nil "RSS title")
>                (item nil
>                      (title nil "article title")
>                      (content:encoded nil "article content")))))
>
> The function "nnrss-get-namespace-prefix" should extract tag
> "xmlns:content". But it only returns nil because "(cadar el)" matches
> nothing.

That's only due to the particular encoding of your RSS feed though,
isn't it?  I believe xmlns prefixes can technically go on any element in
a document; I expect the current code works for some feeds, and your fix
would break things for them.

We should gather some test cases to be able to fix this properly.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]