File: Dictionary_Representation_of_XML_Arrays.html

package info (click to toggle)
tclws 3.5.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 944 kB
  • sloc: tcl: 7,976; makefile: 18
file content (66 lines) | stat: -rw-r--r-- 2,335 bytes parent folder | download | duplicates (5)
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
66
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Web Services for Tcl (aka tclws): Dictionary Representation of XML Arrays</title>
<link rel="stylesheet" href="style.css" type="text/css" media="screen">
</head>
<body>
<p>
XML arrays are represented in dictionary format as a list of values.
Lets consider what this looks like for a
<a href="#SimpleTypeArray">simple type</a> and for a
<a href="#ComplexTypeArray">complex type</a>;.
</p>

<p><a name="SimpleTypeArray"></a>
</p><h3>Array of Simple Type</h3>
<p>
Lets assume we have an element with the following definition:
</p><pre class="verbatim">    &lt;xs:element minOccurs="0" maxOccurs="unbounded" name="Primes" type="xs:integer" /&gt;
</pre>
Lets also assume that we will have that element in our dictionary with
the first four prime numbers, thus the dictionary representation for
that element would look like:
<pre class="verbatim">    Primes {2 3 5 7}
</pre>
Or, if we have are using attributes (i.e. parseInAttr and/or genOutAttr are set), it would look like:
<pre class="verbatim">    Primes {{} {2 3 5 7}}
</pre>
<p></p>

<p><a name="ComplexTypeArray"></a>
</p><h3>Array of Complex Type</h3>
<p>
Lets assume we have the type definition:
</p><pre class="verbatim">&lt;xs:element name="Person"&gt;
  &lt;xs:complexType&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name="FristName" type="xs:string"/&gt;
      &lt;xs:element name="LastName" type="xs:integer"/&gt;
    &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
&lt;/xs:element&gt;
</pre>
Lets assume we have the following definition:
<pre class="verbatim">    &lt;xs:element minOccurs="0" maxOccurs="unbounded" name="Attendees" type="Person" /&gt;
</pre>
Now lets assume the following people are are attending:
<ul>
<li> John Doe </li>
<li> Jane Doe </li>
</ul>
Thus the dictionary representation for that element would look like:
<pre class="verbatim">    Attendees {
        {FirstName {John} LastName {Doe}}
        {FirstName {Jane} LastName {Doe}}
    }
</pre>
Or, if we have are using attributes (i.e. parseInAttr and/or genOutAttr are set), it would look like:
<pre class="verbatim">    Attendees {
        {{} {FirstName {{} {John}} LastName {{} {Doe}}}}
        {{} {FirstName {{} {Jane}} LastName {{} {Doe}}}}
    }
</pre>
<p></p>
</div>
</body></html>