Re: How to write XML?

2012-06-17 Thread fenton
Thanks Mark that was it!

On Friday, June 15, 2012 6:07:56 AM UTC-7, mwillson wrote:

 On Wednesday, 13 June 2012 20:35:41 UTC+1, fenton wrote:

 For some reason I cannot create an XML node.  Sample code 
 here.https://gist.github.com/ce66585542f4b426381c Any 
 assistance much appreciated.


 I think you need to create a zipper from the root node returned by 
 (zip/root), so,

 (def joey-text (zd/xml- (zip/xml-zip new-xml) :b2))

 -mark


-- 
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

Re: How to write XML?

2012-06-16 Thread mwillson
On Wednesday, 13 June 2012 20:35:41 UTC+1, fenton wrote:

 For some reason I cannot create an XML node.  Sample code 
 here.https://gist.github.com/ce66585542f4b426381c Any 
 assistance much appreciated.


I think you need to create a zipper from the root node returned by 
(zip/root), so,

(def joey-text (zd/xml- (zip/xml-zip new-xml) :b2))

-mark

-- 
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

Re: How to write XML?

2012-06-16 Thread Alfred Xiao
; z2 - by parsing and zipping a string - vs. new-xml

ftxml.core (def z2 (zip-str ab1ton/b1b2joey/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 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

How to write XML?

2012-06-13 Thread fenton
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 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