Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 575de3ec6e6cfa6cefa80a28ad317ca1 > files > 31

ocaml-tyxml-2.2.0-4.mga4.x86_64.rpm


== TypedXML

tyxml is a parser and printer for xml, and a simple library for
building valid XHTML 1.1, HTML5 or SVG tree. The generic printer
allows a HTML compatible mode.

 * Directory {{{lib}}}

   XHTML typing using Thorsten Ohl's XHTML.M library to validate xml
   tree at compile-time, adapted to support HTML5 and SVG.

   The implementation uses a XML module for generating well
   formed---but not necessarily valid with respect to some DTD---XML
   documents.  The elements of type XML.elt and attributes of type
   XML.attrib are then hidden behind polymorphic phantom types type 'a
   elt = XML.elt and type 'a attrib = XML.attrib with 'a set to
   appropriate polymorphic variants.


 * Directory {{{syntax}}}

   A syntax extension to write XHTML or HTML5 inside a caml program.

== Requirements:

 * ocaml and camlp4
 * findlib
 * ocamlnet (for netstring-pcre)

 [optionnal]
 * ocamlduce

== Build intructions:

 $ ${EDITOR} Makefile.config
 $ make
 $ make install

== API documentation:

 $ make doc
 $ ${BROWSER} doc/api-html/index.html

== Examples:

 $ ocaml
        Objective Caml version 3.12.1

 # #use "topfind";;
 - : unit = ()
 # #camlp4o;;
	Camlp4 Parsing version 3.12.1

 # #require "tyxml.syntax";;
 # let x = << <a href="url"> Contents </a> >>;;
 val x : [> `A ] HTML5.M.elt = <abstr>
 # HTML5.P.print_list ~output:print_string [x];;
 - : string = "<a href=\"url\"> Contents </a>\n"
 # let x = << <html> <br/> </html> >>;;
 Error: This expression cannot be coerced to type
          ([< HTML5_types.html_content ] as 'a) HTML5.M.elt list;
        it has type ([> HTML5_types.br ] as 'b) HTML5.M.elt list
        but is here used with type 'a HTML5.M.elt list
        Type 'b = [> `Br ] is not compatible with type 'a = [< `Body | `Head ]
        The second variant type does not allow tag(s) `Br