由:bpeter 评论
如您所见,我找到一个“解决方案”并且在(链接:^zip-xml-bug-descent.tgz)中
`
(defn descent=
[tagname]
(fn [loc]
(filter #(and (zip/branch? %) (= tagname (:tag (zip/node %))))
(testing "using descent to select the name of inner"
(is (= "Inner"
(-> (zip-xml/xml1-> root :Root :Group (descent= :Group) :Name zip-xml/text)))))
`
It seems the first expression in {{tag=}} matching the element itself in the {{or}} expression is the problem in my case. I suspect it can be used to select the root element. Is there any other need for it?
`
(defn tag=
[tagname]
(fn [loc]
(or (= tagname (:tag (zip/node loc)))
(filter #(and (zip/branch? %) (= tagname (:tag (zip/node %))))
(zf/children-auto loc)))))
`
也许应该有一个 {{self}} 前缀?