Package: closure-html

Function serialize-lhtml

Lambda List

serialize-lhtml (document handler &key (name HTML) public-id system-id)


  • document -- an LHTML list
  • handler -- a HAX/SAX handler
  • name -- root element name, a rod/string
  • public-id -- nil or the Public ID, a rod/string
  • system-id -- nil or the System ID/URI, a rod/string

Return Value

The return value of this function is determined by the handler argument; see below.


Serialize the LHTML document into HAX events, sent to the specified HAX handler.

handler can be a HAX handler (see hax:abstract-handler) or a SAX handler (see the SAX protocol in cxml).

The result of calling hax:end-document on the handler will be returned from this function.

If system-id is specified, a doctype will be written according to the arguments name, public-id, and system-id.

Use this function with a serialization sink to get a string or file with a serialized HTML document, or with a HAX/SAX builder to convert LHTML into a different representation, like DOM, PT, or STP.

 (let ((x '(:HTML NIL (:HEAD NIL) (:BODY NIL (:P NIL "nada"))))))
   (chtml:serialize-lhtml x (chtml:make-string-sink))       
=> "<HTML><HEAD></HEAD><BODY><P>nada</P></BODY></HTML>"


See also