Package: closure-html

Function serialize-pt

Lambda List

serialize-pt (document handler &key (name HTML) public-id system-id (documentp t))

Arguments

  • document -- an pt instance
  • 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.

Details

Serialize the PT node 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 PT into a different representation, like DOM, LHTML, or STP.

Example:
 (let ((x (chtml:parse "<p>nada</p>" (chtml:make-pt-builder)))))
   (chtml:serialize-pt x (chtml:make-string-sink))       
=> "<HTML><HEAD></HEAD><BODY><P>nada</P></BODY></HTML>"

 

See also