Dear friends

I am trying to parse xml file 
following is code

(def xml-file "d:/clj/xmlfiles/orders.xml")
(def xmldata (clojure.xml/parse xml-file))
(println xmldata)

Output is :

{:tag :order, :attrs {:orderid 1/2011}, :content [{:tag :party, :attrs nil, 
:con
tent [ XYZ Ltd ]} {:tag :address, :attrs nil, :content [{:tag :block, :attrs 
nil
, :content [ Abcd.]} {:tag :street, :attrs nil, :content [ xyz ]} {:tag 
:city, :
attrs nil, :content [ 123]} {:tag :state, :attrs nil, :content [ in ]}]}]


Now i change to output xml seq  usng xml-seq

(def xml-file "d:/clj/xmlfiles/orders.xml")
(def xmlseq (xml-seq (clojure.xml/parse xml-file)))
(println xmlseq)

Ouput is :
({:tag :order, :attrs {:orderid 1/2011}, :content [{:tag :party, :attrs nil, 
:co
ntent [ XYZ Ltd ]} {:tag :address, :attrs nil, :content [{:tag :block, 
:attrs ni
l, :content [ Abcd.]} {:tag :street, :attrs nil, :content [ xyz ]} {:tag 
:city,
:attrs nil, :content [ 123]} {:tag :state, :attrs nil, :content [ in ]}]}]} 
{:ta
g :party, :attrs nil, :content [ XYZ Ltd ]}  XYZ Ltd  {:tag :address, :attrs 
nil
, :content [{:tag :block, :attrs nil, :content [ Abcd.]} {:tag :street, 
:attrs n
il, :content [ xyz ]} {:tag :city, :attrs nil, :content [ 123]} {:tag 
:state, :a
ttrs nil, :content [ in ]}]} {:tag :block, :attrs nil, :content [ Abcd.]} 
 Abcd.
 {:tag :street, :attrs nil, :content [ xyz ]}  xyz  {:tag :city, :attrs nil, 
:co
ntent [ 123]}  123 {:tag :state, :attrs nil, :content [ in ]}  in )


Here the output show double items for each tag... what's problem ?

Thanks in advance
Vincent

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