Commit 7bb47d0f authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2004-09-28 22:04:35 by beppe] Empty log message

Original author: beppe
Date: 2004-09-28 22:07:09+00:00
parent f21a138a
......@@ -256,7 +256,7 @@ let parents : ParentBook = {{load_xml}} "parents.xml"
we would obtain a type error as we were trying to use an expression of type
<code>Any</code> where an expression of type <code>ParentBook</code> is expected.
The right way to reproduce the binding above is:
</p> load_xml "parents.xml"
</p>
<sample><![CDATA[
let parents : ParentBook =
match load_xml "parents.xml" with
......@@ -274,18 +274,29 @@ type <code>ParentBook</code>) then it performs the assignment (the variable
</p>
<p>
The command <code>load_xml "parents.xml"</code> is just an abbreviated form for
<code>load_xml "{{file://}}parents.xml"</code>. If CDuce has been compiled with
netclient or curl support, it is also possible to use other URI schemes such as
<code>load_xml "{{file://}}parents.xml"</code>. If CDuce is compiled with
netclient or curl support, then it is also possible to use other URI schemes such as
http:// or ftp://. A special scheme string:// is always supported: the string
following the scheme is parsed as it is.
<footnote>
All these schemes are available for <code>load_html</code> and <code>load_file</code> as well.
</footnote>
So, for instance, <code>load_xml
"string://%%exp%%"</code> corresponds to XQuery <code>{%%exp%%}</code> to
parse litteral XML code <code>%%exp%%</code>, while <code>load_xml
("string://" @ x)</code> parses the XML code associated to the string variable <code>x</code>.
"string://%%exp%%"</code>
parses litteral XML code <code>%%exp%%</code> (it corresponds to XQuery's <code>{ %%exp%% }</code>), while <code>load_xml
("string://" @ x)</code> parses the XML code associated to the string variable <code>x</code>. Thus the following definition of <code>x</code>
</p>
<sample><![CDATA[
let x : Any = <person>[ <name>"Alice" <children>[] ]
]]></sample>
<p>
is completely equivalent to this one
</p>
<sample><![CDATA[
let x = load_xml "string://<person><name>Alice</name> <children/></person>"
]]></sample>
</box>
<box title="Type declarations" link="type_decl">
......
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