I’ve been using xml-seq for XML Parsing in a project and wondered if it’s possible to use a sax parser instead. I’ve found there is a function called startparse-sax, but I can’t find any examples for it? Does anyone have or know of any simple examples using startparse-sax?
I’ve been using xml-seq for XML Parsing in a project and wondered if it’s
Share
Your question is a little bit confusing. First of all,
xml-seqis not for parsing. It is designed to be used on the output fromclojure.xml/parseand returns a sequence of all nodes in the XML tree. Secondly, clojure.xml/parse is built on top of SAX, so if you are usingclojure.xml/parseyou are already using SAX indirectly. You can find examples on how to use it here: http://clojuredocs.org/clojure_core/clojure.xml/parseIt is also possible to give
clojure.xml/parsea specific SAX parser if you don’t want the default one. You do this by providing a “startparse” function to be used instead of the defaultstartparse-sax. Here is an example on how to use the TagSoup HTML parser (which is exposed as a SAX parser) withclojure.xml/parse: https://gist.github.com/2378475 . (This is similar to what Enlive does.)