I'm really struggling to understand how to parse XML in Clojure.

Here's my xml:

<javancss>
   <function>
      <name>java.complexity.HelloWorld.notcomplex()</name>
      <ncss>2</ncss>
      <ccn>1</ccn>
      <javadocs>0</javadocs>
    </function>
    <function>
      <name>java.complexity.HelloWorld.complex(int)</name>
      <ncss>4</ncss>
      <ccn>2</ccn>
      <javadocs>0</javadocs>
    </function> 
... etc

I can do (xml-seq (xml/parse .. )) on this, or ( zip/xml-zip  (xml/parse 
... ), I don't mind which.

My task is to extract all the function elements where the ncss value > 3, 
then sum the ccn values of the remaining elements.  I simply cannot figure 
out how to do this.  All I can do is extract text of particular elements, 
e.g. 

(apply + (map read-string (zf/xml-> ncss-zip :functions :function :ccn 
 zf/text)))

If anyone can help out, it would be 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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to