评论由:bpeter 提供
如您所见,我发现了一个“解决方案”,在(链接:^zip-xml-bug-descent.tgz)中。
`
(defn descent=
[tagname]
(fn [loc]
(filter #(and (zip/branch? %) (= tagname (:tag (zip/node %))))
(testing "使用descend选择内部名称"
(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}}谓词呢?