1. camlspotter
  2. my-externals


my-externals / xml-light /

The default branch has multiple heads

Filename Size Date modified Message
66 B
156 B
124 B
106 B
3.1 KB
673 B
2.4 KB
15.3 KB
5.5 KB
65 B
1.9 KB
2.3 KB
531 B
7.0 KB
5.7 KB
5.5 KB
3.5 KB
1.7 KB
12.8 KB
2.0 KB
Xml-Light Version 2.2 :

Last version : http://tech.motion-twin.com

  Xml Light is a minimal Xml parser & printer for OCaml.
  It provide few functions to parse a basic Xml document into
  an OCaml data structure and to print back the data structures
  to an Xml document.

  Xml Light has also support for DTD (Document Type Definition).


make install

by default, Xml Light is installed in the 'ocamlc -where' directory.
you can change it by editing the Makefile.

for Windows users, if you're using the MSVC version of ocaml and
don't have cygwin tools installed, you can do : nmake all
and then copy manually the files to the place you want.


simple samples :

-- parse / print an xml string ---

let x = Xml.parse_string "<a href='url'>TEXT<begin/><end/></a>" in
Printf.printf "XML formated = \n%s" (Xml.to_string_fmt x);

-- load an xml and a dtd , prove and print ---

let x = Xml.parse_file "myfile.xml" in
let dtd = Dtd.parse_file "myfile.dtd" in
let x = Dtd.prove (Dtd.check dtd) "start" x in
print_endline (Xml.to_string x)


HTML documentation can be generated with ocamldoc :

make doc

you can also directly browse the MLI files to read it.


Xml Light is distributed under the terms of the GNU Library General
Public License, with the special exception on linking described
below. (This is the OCaml library licence.)

As a special exception to the GNU Library General Public License, you
may link, statically or dynamically, a "work that uses the Library"
with a publicly distributed version of the Library to produce an
executable file containing portions of the Library, and distribute
that executable file under terms of your choice, without any of the
additional requirements listed in clause 6 of the GNU Library General
Public License. By "a publicly distributed version of the Library", we
mean either the unmodified Library as distributed by INRIA, or a
modified version of the Library that is distributed under the
conditions defined in clause 3 of the GNU Library General Public
License. This exception does not however invalidate any other reasons
why the executable file might be covered by the GNU Library General
Public License.

(c)2003-2005 Nicolas Cannasse (ncannasse@motion-twin.com)
(c)2003-2005 Motion-Twin
Some parts of this code source has an additionnal copyright to Jacques Garrigue