Commit 78e49a10 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-05-15 21:39:35 by cvscast] small modification tutorial Beppe

Original author: cvscast
Date: 2003-05-15 21:39:35+00:00
parent 99b19812
......@@ -99,6 +99,39 @@ let parents : ParentBook =
Note the strightforward correspondence between the two notations: instead of
using an closing tag, we enclose the content of each element in square
brackets. In CDuce square backets denote sequences, that is, heterogenoeus (ordered) lists
of blank-separated elements.
To the purpose of the example we used different notations to denote
strings as in CDuce <code>"xyz"</code>, <code> ['xyz']</code>, <code> ['x' 'y' 'z']</code>,
<code> [ 'xy' 'z' ]</code>, and <code> [ 'x' 'yz' ]</code> define the same string
literal. Note also
that the <code>"Pål André"</code> string is accepted as CDuce supports Unicode
<box title="Loading XML files" link="t0.5">
The program on the right handside in the previous section starts by binding the
variable <code>parents</code> to the XML document. It also specifies that
parents has the type <a href="#t1"><code>ParentBook</code></a>: this is optional
but it usually allows erlier detection of type errors. If the file XML on the
lefthandside is stored in a file, say, <tt>parents.xml</tt> then the same
binding can be obtained by loading the file as follows
let parents : ParentBook = {{load_xml}} "parents.xml"
as <code>load_xml</code> converts and XML document stored into a file in the CDuce expression representing it.</p>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment