[racket] View HTML source code in racket

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Wed Jun 23 16:55:42 EDT 2010

(This message and Insik Cho's response didn't seem to make it to the list.)

Neil Van Dyke wrote at 06/23/2010 03:06 PM:
> Insik Cho wrote at 06/23/2010 02:01 PM:
>> I want to html source of an web page in racket.
>>
>> What module and functions shall I use? and How?
>
> Do you want Racket to get a Web page for you, and then have your 
> program access the HTML of the Web page?
>
> Here is a way to do that:
>
> ;;;;;
>
> #lang racket
>
> (require net/url
>         (planet neil/htmlprag))
>
> (define my-sxml-of-html-page (call/input-url (string->url 
> "http://m.google.com/")
>                                             get-pure-port
>                                             html->sxml))
>
> my-sxml-of-html-page
>
> ;;;;;
>
> To have your program use the SXML representation of HTML that is in 
> variable "my-sxml-of-html-page", you should get comfortable 
> programming with lists in Racket.
>
> There are also tools you can use, such as SXPath.  But I think you 
> should understand lists before using SXPath.
>


Posted on the users mailing list.