;;;;; z2 - by parsing and zipping a string - vs. new-xml
ftxml.core> (def z2 (zip-str "<a><b1>ton</b1><b2>joey</b2></a>"))
#'ftxml.core/z2
ftxml.core> (zd/xml-> z2 :b2)
([{:tag :b2, :attrs nil, :content ["joey"]} {:l [{:tag :b1, :attrs nil,
:content ["ton"]}], :pnodes [{:tag :a, :attrs nil, :content [{:tag :b1,
:attrs nil, :content ["ton"]} {:tag :b2, :attrs nil, :content ["joey"]}]}],
:ppath nil, :r nil}])
ftxml.core> (class z2)
clojure.lang.PersistentVector
ftxml.core> (class new-xml)
clojure.lang.PersistentStructMap
ftxml.core> z2
[{:tag :a, :attrs nil, :content [{:tag :b1, :attrs nil, :content ["ton"]}
{:tag :b2, :attrs nil, :content ["joey"]}]} nil]
ftxml.core> new-xml
{:tag :a, :attrs nil, :content [{:tag :b1, :attrs nil, :content ["ton"]}
{:content ["joey"], :attrs nil, :tag :b2}]}
==> The above code shows that
1. z2 is a PersistentVector while new-xml is PersistentStructMap
2. z2 look similar to new-xml except z2 is a vector and has a nil element
3. expression (zd/xml-> z2 :b2) works
;;;;;; Going on
ftxml.core> (def n2 [new-xml nil])
#'ftxml.core/n2
ftxml.core> (class n2)
clojure.lang.PersistentVector
ftxml.core> n2
[{:tag :a, :attrs nil, :content [{:tag :b1, :attrs nil, :content ["ton"]}
{:content ["joey"], :attrs nil, :tag :b2}]} nil]
ftxml.core> z2
[{:tag :a, :attrs nil, :content [{:tag :b1, :attrs nil, :content ["ton"]}
{:tag :b2, :attrs nil, :content ["joey"]}]} nil]
==> The above code shows that
1. n2 is a PersistentVector, same as z2
2. n2 looks very similar to z2 except ordering of key/valure pairs for
element b2
;;;;; Going on
ftxml.core> (= z2 n2)
true
ftxml.core> (zd/xml-> n2 :b2)
; Evaluation aborted.
==> The above code shows that
1. n2 equals z2 !!
2. but the expression (zd/xml-> n2 :b2) doesn't work for n2 !!
Wonder why......!
On Thursday, June 14, 2012 3:35:41 AM UTC+8, fenton wrote:
>
> For some reason I cannot create an XML node. Sample code
> here.<https://gist.github.com/ce66585542f4b426381c> Any
> assistance much appreciated.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en