Re: dumping maps out to XML

2012-08-23 Thread semperos
The following is a 
start: http://clojuredocs.org/clojure_core/clojure.xml/emit-element

The :tag, :attrs, :content trio is a common pattern in Clojure libraries 
that deal with XML.

-Daniel

On Wednesday, August 22, 2012 9:40:28 PM UTC-4, larry google groups wrote:

 Forgive me if this has been asked before. I am a beginner. I have a data 
 structure that is composed of maps nested inside of a map. What is the 
 easiest way to dump this out as XML? 

-- 
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: dumping maps out to XML

2012-08-23 Thread Denis Labaye
On Thu, Aug 23, 2012 at 3:40 AM, larry google groups 
lawrencecloj...@gmail.com wrote:

 Forgive me if this has been asked before. I am a beginner. I have a data
 structure that is composed of maps nested inside of a map. What is the
 easiest way to dump this out as XML?


Why do you want to do that?

Because if all you want to do is persist data to read it back later you
could just do :


(def m {:person {:firstname john
 :lastname  doe}})

;; persist on disk
(spit /home/d/m.clj m)

;; read back later
(read-string (slurp /home/d/m.clj))



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

-- 
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: dumping maps out to XML

2012-08-23 Thread larry google groups


(def m {:person {:firstname john :lastname  doe}})
(spit /home/d/m.clj m)
(read-string (slurp /home/d/m.clj))


at repl:

{:person {:firstname john, :lastname doe}}

Good lord! How long has this been going on?



On Thursday, August 23, 2012 9:39:43 AM UTC-4, Denis Labaye wrote:



 On Thu, Aug 23, 2012 at 3:40 AM, larry google groups 
 lawrenc...@gmail.comjavascript:
  wrote:

 Forgive me if this has been asked before. I am a beginner. I have a data 
 structure that is composed of maps nested inside of a map. What is the 
 easiest way to dump this out as XML? 


 Why do you want to do that?

 Because if all you want to do is persist data to read it back later you 
 could just do : 


 (def m {:person {:firstname john
  :lastname  doe}})

 ;; persist on disk
 (spit /home/d/m.clj m)

 ;; read back later
 (read-string (slurp /home/d/m.clj))

  

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




-- 
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: dumping maps out to XML

2012-08-23 Thread larry google groups
semperos, thanks. I might for now stick with Denis's suggestion, as it is 
simple, but the clojure docs you point out will be useful when I get more 
ambitious.

On Thursday, August 23, 2012 8:21:09 AM UTC-4, semperos wrote:

 The following is a start: 
 http://clojuredocs.org/clojure_core/clojure.xml/emit-element

 The :tag, :attrs, :content trio is a common pattern in Clojure libraries 
 that deal with XML.

 -Daniel

 On Wednesday, August 22, 2012 9:40:28 PM UTC-4, larry google groups wrote:

 Forgive me if this has been asked before. I am a beginner. I have a data 
 structure that is composed of maps nested inside of a map. What is the 
 easiest way to dump this out as XML? 



-- 
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: dumping maps out to XML

2012-08-23 Thread Jim - FooBar();
make sure to bind *read-eval* to false when reading arbitrary code from 
files...


(defn read-back
Read the file f back on memory. Careful not to eval anything dangerous 
(#=).

[f]
(binding [*read-eval* false]
(read-string (slurp f

Jim


On 23/08/12 21:32, larry google groups wrote:

(def m {:person {:firstname john:lastnamedoe}})
(spit /home/d/m.clj m)
(read-string (slurp /home/d/m.clj))

at repl:

{:person {:firstname john, :lastname doe}}

Good lord! How long has this been going on?



On Thursday, August 23, 2012 9:39:43 AM UTC-4, Denis Labaye wrote:



On Thu, Aug 23, 2012 at 3:40 AM, larry google groups
lawrenc...@gmail.com javascript: wrote:

Forgive me if this has been asked before. I am a beginner. I
have a data structure that is composed of maps nested inside
of a map. What is the easiest way to dump this out as XML? 



Why do you want to do that?

Because if all you want to do is persist data to read it back
later you could just do :

(def m {:person {:firstname john

:lastname doe}})

;; persist on disk
(spit /home/d/m.clj m)

;; read back later
(read-string (slurp /home/d/m.clj))

-- 
You received this message because you are subscribed to the Google

Groups Clojure group.
To post to this group, send email to clo...@googlegroups.com
javascript:
Note that posts from new members are moderated - please be
patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com javascript:
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
http://groups.google.com/group/clojure?hl=en


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


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

dumping maps out to XML

2012-08-22 Thread larry google groups
Forgive me if this has been asked before. I am a beginner. I have a data 
structure that is composed of maps nested inside of a map. What is the 
easiest way to dump this out as XML? 

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