Re: Newbie trying HTML parsing

2015-10-16 Thread edbond
Hello Mike, Take a look at hickory, it's more straightforward than enlive if you want to find something in html: https://github.com/davidsantiago/hickory (ns .. (:require [hickory.core :as h] [hickory.select :as hs] [cljs.core.async :as a])) let [html (:

Re: Newbie trying HTML parsing

2015-10-15 Thread James Reeves
On 15 October 2015 at 18:00, Mike wrote: (dzx/xml1-> my-zipper dz/descendants) > > gives me what appears to be the original zipper structure, which I wasn't > expecting. I was expecting a flattened-out seq of the nodes. > The dz/descendants function doesn't return a seq of nodes, but a seq of z

Re: Newbie trying HTML parsing

2015-10-15 Thread Mike
> > I've read the clojure.data.xml.zip docs carefully and looked at many > examples, but I don't understand this behavior: > (require '[clj-http.client :as client] '[clojure.zip :as z] '[clojure.data.zip :as dz] '[clojure.data.zip.xml :as dzx] '[crouton.html

Re: Newbie trying HTML parsing

2015-10-14 Thread James Reeves
It looks like the response body is a string rather than a stream. Try using crouton.html/parse-string instead. - James On 15 October 2015 at 01:27, Mike wrote: > So now I'm trying to make the conversion to Crouton. Of course that is > not going well. Here is a chunk of code: > > (ns one.core

Re: Newbie trying HTML parsing

2015-10-14 Thread Mike
So now I'm trying to make the conversion to Crouton. Of course that is not going well. Here is a chunk of code: (ns one.core (:gen-class)) (require '[clj-http.client :as client] '[clojure.zip :as z] '[clojure.data.zip :as dz] '[clojure.data.zip.xml :as dzx]

Re: Newbie trying HTML parsing

2015-10-14 Thread Matching Socks
(Enlive wraps JSoup and TagSoup and causes them both to return a value in the same format as clojure.xml. Likewise, Enlive's transformation features will work with anything that looks like clojure.xml.) -- You received this message because you are subscribed to the Google Groups "Clojure" grou

Re: Newbie trying HTML parsing

2015-10-14 Thread James Reeves
I'm not that familiar with Enlive, so I can't comment on the ease of that approach. However, the way I'd personally do it is that I'd make use of Crouton and the zipper functions in clojure.zip and clojure.data.zip. A zipper is a functional way of navigating an immutable data structure. So first

Re: Newbie trying HTML parsing

2015-10-14 Thread Mike
Thanks James! You helped me get another step along the way, I got this working. Of course you mentioned Crouton; you should and I asked for advice on my approach. So please allow me to expand the problem statement and you may advise me further... Once I get this HTML parsed, I know that some

Re: Newbie trying HTML parsing

2015-10-14 Thread James Reeves
In the clj-tagsoup example it has the following line: (use 'pl.danieljanus.tagsoup) The use function is like require, except it aliases the vars to the current namespace. So the pl.danieljanus.tagsoup is the namespace to use. If the README doesn't provide any clues, you can sometimes figure