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

From: Lars Ingebrigtsen <[email-masked]>
Date: Mon, 09 Aug 2021 14:13:29 +0200

Benjamin Riefenstahl <[email-masked]> writes:

> LS09LT0tPQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW4KCkhpIExhcnMsCgpMYXJzIEluZ2Vicmln
> dHNlbiB3cml0ZXM6Cj4gSSd2ZSBub3cgZml4ZWQgdGhpcyBtb3JlIGdlbmVyYWxseSBieSBzZWFy

Your message arrived kinda destroyed, but I used my decoder ring:

> This doesn't seem to work.  I encountered the problem just now on Emacs
> master with https://sql-ledger.com/userforum/index.php?mode=rss .  The
> attached patch fixes it for me.

[...]

> -  (let* ((prefix (car (rassoc uri (dom-attributes
> +  (let* ((prefix (car (or (rassoc uri (dom-attributes el))
> +                          (rassoc uri
> +                                  (dom-attributes

[...]

> +(defconst test-nnrss-xml
> +  '((rss
> +     ((version . "2.0")
> +      (xmlns:dc . "http://purl.org/dc/elements/1.1/"))
> +     (channel
> +      ((xmlns:content . "http://purl.org/rss/1.0/modules/content/"))))))

The problem here is that this test XML isn't a valid DOM -- it's a
list of DOMs.  A valid DOM would be

(defconst test-nnrss-xml
  '(rss
    ((version . "2.0")
     (xmlns:dc . "http://purl.org/dc/elements/1.1/"))
    (channel
     ((xmlns:content . "http://purl.org/rss/1.0/modules/content/")))))

and in this case the test works fine.  So if EL is a list of nodes, then
it's the caller of nnrss-get-namespace-prefix here that should be
adjusted to pass in the car of the list instead?  Could you try that and
see whether that works?  (And send a new patch; I've applied your test
(adjusted).)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no