Function: newsticker--parse-atom-1.0

newsticker--parse-atom-1.0 is a byte-compiled function defined in newst-backend.el.gz.

Signature

(newsticker--parse-atom-1.0 NAME TIME TOPNODE)

Documentation

Parse Atom 1.0 data.

Argument NAME gives the name of a news feed. TIME gives the system time at which the data have been retrieved. TOPNODE contains the feed data as returned by the xml parser.

For the Atom 1.0 specification see URL http://www.atompub.org/2005/08/17/draft-ietf-atompub-format-11.html

Source Code

;; Defined in /usr/src/emacs/lisp/net/newst-backend.el.gz
(defun newsticker--parse-atom-1.0 (name time topnode)
  "Parse Atom 1.0 data.
Argument NAME gives the name of a news feed.  TIME gives the
system time at which the data have been retrieved.  TOPNODE
contains the feed data as returned by the xml parser.

For the Atom 1.0 specification see
URL `http://www.atompub.org/2005/08/17/draft-ietf-atompub-format-11.html'"
  (newsticker--debug-msg "Parsing Atom 1.0 feed %s" name)
  (let (new-feed new-item)
    (setq new-feed (newsticker--parse-generic-feed
                    name time
                    ;; title
                    (car (xml-node-children
                          (car (xml-get-children topnode 'title))))
                    ;; desc
                    (car (xml-node-children
                          (car (xml-get-children topnode 'subtitle))))
                    ;; link
                    (lambda (node)
                      (xml-get-attribute
                       (car (xml-get-children node 'link)) 'href))
                    ;; extra-elements
                    (xml-node-children topnode)))
    (setq new-item (newsticker--parse-generic-items
                    name time (xml-get-children topnode 'entry)
                    ;; title-fn
                    (lambda (node)
                      (car (xml-node-children
                            (car (xml-get-children node 'title)))))
                    ;; desc-fn
                    (lambda (node)
                      ;; unxml the content or the summary node. Atom
                      ;; allows for integrating (x)html into the atom
                      ;; structure but we need the raw html string.
                      ;; e.g. https://www.heise.de/open/news/news-atom.xml
                      ;; http://feeds.feedburner.com/ru_nix_blogs
                      (or (newsticker--unxml
                           (car (xml-node-children
                                 (car (xml-get-children node 'content)))))
                          (newsticker--unxml
                           (car (xml-node-children
                                 (car (xml-get-children node 'summary)))))
                          (car (xml-node-children
                                (car (xml-get-children node 'summary))))))
                    ;; link-fn
                    (lambda (node)
                      (xml-get-attribute
                       (car (xml-get-children node 'link)) 'href))
                    ;; time-fn
                    (lambda (node)
                      (newsticker--decode-iso8601-date
                       (or (car (xml-node-children
                                 (car (xml-get-children node 'updated))))
                           (car (xml-node-children
                                 (car (xml-get-children node 'published)))))))
                    ;; guid-fn
                    (lambda (node)
                      (car (xml-node-children
                            (car (xml-get-children node 'id)))))
                    ;; extra-fn
                    (lambda (node)
                      (xml-node-children node))))
    (or new-item new-feed)))