On Dec 2, 4:51 pm, Dennis <shr3ks...@gmail.com> wrote: > The XML is of the form: > ganglia > multiple clusters > multiple hosts > multiple metrics
Use XPath. Seriously, I hate XML and XSLT, but XPath is simply the most concise way to extract things from a nested structure. Most XPath- libraries allow for precompilation of XPath-expressions (similar to RegEx-precompilation) and don't require the whole XML-file to reside in memory, which makes this a nice solution for huge XML-files (though in your case this is probably no issue). To get a list of all metrics in all hosts in all clusters, you'd simply use the XPath-expression "ganglia/cluster/host/metric" against an XML-document; recursive fetching (if clusters could contain other clusters) could be done by using a double slash instead of a single slash. A Clojure-solution for a similar expression language would be clojure.contrib.zip-filter.xml, though I did not use it, but you might try it out. -- 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