[plt-scheme] Re: plt-scheme Digest, Vol 8, Issue 1

From: Danny Yoo (dyoo at hkn.eecs.berkeley.edu)
Date: Sat Apr 1 14:37:26 EST 2006


> Has anyone used Lizorkin's SSAX and SXML packages?  I have been trying
> to get them to display google's web site for a bit now and for one
> reason or another keep running into road blocks.
>
> (sxml:document
>    (read-html-as-xml
>       (get-pure-port
>          (string->url "http://www.google.com"))))


Hi Geb,

sxml:document takes in a url string, so we can go directly to:


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(module test-sxml mzscheme
  (require (planet "sxml.ss" ("lizorkin" "sxml.plt" 1 3)))
  (require (lib "pretty.ss"))
  (pretty-print (sxml:document "http://www.google.com/index.html")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



Also, here's another example using htmlprag:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(module test-htmlprag mzscheme
  (require (planet "htmlprag.ss" ("neil" "htmlprag.plt" 1 3)))
  (require (lib "url.ss" "net"))
  (require (lib "pretty.ss"))

  (define google-url (string->url "http://www.google.com/"))
  (define google-front-page
    (call/input-url google-url get-pure-port html->shtml))

  (pretty-print google-front-page))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


Hope this helps!



Posted on the users mailing list.