/
README
65 lines (46 loc) · 1.75 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
== 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
[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