> Does anyone know how to update xml element attribute value on the zipper
> data structure?
> I have something like
> <root>
>     <element1 name="x1" description="d1"/>
>     <element2 name="x2" description="d2"/>
> </root>
> (:require (clojure [xml :as xml] [zip :as zip])
>      [clojure.contrib.zip-filter.xml :as zf])
> (let
>   [src (-> "c:/my.xml" io/file xml/parse zip/xml-zip)
>    edf (zf/xml1-> src :root :element1)
>    n    (-> (zf/attr :description) (zip/replace "dddd"))])
> and this is giving me java.lang.ClassCastException: java.lang.Character
> cannot be cast to clojure.lang.Associative (test-xml-zip.clj:0)

Given that 'loc is the proper location in your zipper:

(zip/edit loc assoc-in [:attrs :description] "new value")

Allen

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to