Clojure:使用clj xpath从xml提取数据

Clojure:使用clj xpath从xml提取数据,xml,xpath,clojure,Xml,Xpath,Clojure,我正在使用clj xpath库从来自API的xml中提取数据。作为输出,我期待一个标签及其内容的映射。我有一个有效的函数,下面是代码片段: (use 'clj-xpath.core) (def data-url str "http://api.eventful.com/rest/events/search?" "app_key=4H4Vff4PdrTGp3vV&" "keywords=music&location=New+York&date=Future") (de

我正在使用clj xpath库从来自API的xml中提取数据。作为输出,我期待一个标签及其内容的映射。我有一个有效的函数,下面是代码片段:

(use 'clj-xpath.core)

(def data-url
 str "http://api.eventful.com/rest/events/search?" "app_key=4H4Vff4PdrTGp3vV&" "keywords=music&location=New+York&date=Future")

(defn create-keys [tags]
(into [] (map keyword tags)))

(defn tag-fn [tag] (partial $x:text tag))

(defn func-contents [tags root-tag data-url] 
 (map (apply juxt (map tag-fn tags)) (take 2 ($x root-tag (xml->doc (slurp data-url ))))))

(defn create-contents [tags root-tag data-url] 
(map #(zipmap (create-keys tags) %) (func-contents tags root-tag data-url)))
但是,当我调用createcontents时,它不会添加键

(func-contents ["url" "title"] "//event" data-url)

(["http://newyorkcity.eventful.com/events/chamber-music-society-lincoln-center-mixed-wind-/E0-001- 067617553-1?utm_source=apis&utm_medium=apim&utm_campaign=apic" "Chamber Music Society of Lincoln Center - MIxed Winds"] ["http://newyorkcity.eventful.com/events/evil-dead-musical-/E0-001-070989019-4?utm_source=apis&utm_medium=apim&utm_campaign=apic" "Evil Dead The Musical"])
当我只评估它的身体时,它给出了预期的结果

(map #(zipmap (create-keys ["url" "title"]) %) (func-contents ["url" "title"] "//event" data-url))
({:title "Chamber Music Society of Lincoln Center - MIxed Winds", :url    "http://newyorkcity.eventful.com/events/chamber-music-society-lincoln-center-mixed-wind-/E0-001-067617553-1?utm_source=apis&utm_medium=apim&utm_campaign=apic"} {:title "Evil Dead The Musical", :url "http://newyorkcity.eventful.com/events/evil-dead-musical-/E0-001-070989019-4?utm_source=apis&utm_medium=apim&utm_campaign=apic"})

有什么想法吗?可能问题出在create keys函数中,但我需要它,因为我需要一个用于任何标记集的通用函数。

您现在可能需要更改api键。。。所以数据永远是公开的,所以编辑这个问题不会将其从互联网上删除。你能粘贴一点api响应吗?这里是9980 10 998 1 0.065林肯中心室内乐协会-混合风,我会更改api密钥,是的。。。。