Created
August 24, 2011 18:46
-
-
Save arohner/1168833 to your computer and use it in GitHub Desktop.
Clojure zippers with HTML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; requires [org.ccil.cowan.tagsoup/tagsoup "1.2"] | |
(defn startparse-tagsoup [s ch] | |
(let [p (new org.ccil.cowan.tagsoup.Parser)] | |
(. p (setContentHandler ch)) | |
(. p (parse s)))) | |
(defn parse-html-string [html] | |
(xml/parse (new org.xml.sax.InputSource | |
(new java.io.StringReader html)) | |
startparse-tagsoup)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment