From: ·········@yahoo.com
Subject: Question on parse-html
Date: 
Message-ID: <1128442577.839857.205570@g47g2000cwa.googlegroups.com>
I loaded the CL-HTML-Parse package and I try to parse the html text and
extract a certain tag from it. I am not sure how can I do it using
proper lisp and I couldn't find the utilities that just extract say
BODY from html text. So any suggestions are welcomed.
Also if I write my own function that must return part of the list (BODY
lhtml list in my case) can it be done without the global variable
*tag*?

(in-package :net.html.parser)
(defvar parsed-html (parse-html "<HTML>
                    <HEAD>
                    <TITLE>Example HTML input</TITLE>
                    <BODY>
                    <P>Here is some text with a <B>bold</B> word<br>and
a <A HREF=\"help.html\">link</P>
                    </HTML>"))


(defvar *tag* nil)

(defun get-tag-lhtml (tag buffer)
  (if (not (atom buffer))
      (dolist (item buffer)
	(if (equal (car buffer) tag)
	    (setq *tag* (cadr buffer))
	    (get-tag-lhtml tag item)))))

(get-tag-lhtml :BODY parsed-html))

After that *tag* contains the BODY list of html. Next step would be to
convert *tag* to string or stream so I can save it as a block of html.
I thought those utilities would be part of the package but I couldn't
find them.
Any suggestions are appreciated!
From: ···@jhb.ucs.co.za
Subject: Re: Question on parse-html
Date: 
Message-ID: <1128587578.372690.119870@g14g2000cwa.googlegroups.com>
·········@yahoo.com wrote:
<SNIP>
> After that *tag* contains the BODY list of html. Next step would be to
> convert *tag* to string or stream so I can save it as a block of html.
> I thought those utilities would be part of the package but I couldn't
> find them.
> Any suggestions are appreciated!

The htmlgen package is probably what you are looking for,
you can find it at <http://cliki.net/htmlgen>.

(net.html.generator:html-print (get-tag-lhtml :body parsed-html)
                               *standard-output*)

Cheers, 
  Sean.