next up previous
Next: General Structures Up: The PiLLoW/CIAO Library for Previous: Writing Form Handlers with

Handling HTML as Prolog Terms

 

Since LP/CLP systems perform symbolic processing using Herbrand terms, it seems natural to be able to handle HTML code directly as terms. Then, such structures only need to be translated by appropriate predicates to HTML code when they need to be output. In general, this relationship between HTML code and Prolog terms allows viewing any WWW page as a Herbrand term. The predicates which provide this functionality in PiLLoW are:

In an HTML term certain atoms and structures represent special functionality at the HTML level. An HTML term can be recursively a list of HTML terms. The following are legal HTML terms:

hello
[hello, world]
["This is an ", em('HTML'), " term"]

When converting HTML terms to characters, html2terms/2 translates special structures into the corresponding format in HTML, applying itself recursively to their arguments. Strings are always leaved unchanged. HTML terms may contain logic variables, provided they are instantiated before the term is translated or output. This allows creating documents piecemeal, backpatching of references in documents, etc.

In the following sections we list the meaning of the principal Prolog structures that represent special functionality at the HTML level. Only special atoms are translated, the rest are assumed to be normal text and will be passed through to the HTML document.





Daniel Cabeza Gras
Fri Oct 4 18:56:02 MET DST 1996