| 1 |
<page name="manual_schema_samples">
|
| 2 |
|
| 3 |
<title>XML Schema sample documents</title>
|
| 4 |
|
| 5 |
<box title="Sample XML documents" link="sample">
|
| 6 |
<p>
|
| 7 |
All the examples you will see in the manual section regarding CDuce's XML
|
| 8 |
Schema support are related to the XML Schema Document <code>mails.xsd</code>
|
| 9 |
and to the XML Schema Instance <code>mails.xml</code> reported below.
|
| 10 |
</p>
|
| 11 |
</box>
|
| 12 |
|
| 13 |
<box title="mails.xsd" link="mails_xsd">
|
| 14 |
<sample><![CDATA[
|
| 15 |
<!-- mails.xsd -->
|
| 16 |
|
| 17 |
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
| 18 |
|
| 19 |
<xsd:element name="mails" type="mailsType" />
|
| 20 |
|
| 21 |
<xsd:complexType name="mailsType">
|
| 22 |
<xsd:sequence minOccurs="0" maxOccurs="unbounded">
|
| 23 |
<xsd:element name="mail" type="mailType" />
|
| 24 |
</xsd:sequence>
|
| 25 |
</xsd:complexType>
|
| 26 |
|
| 27 |
<xsd:complexType name="mailType">
|
| 28 |
<xsd:sequence>
|
| 29 |
<xsd:element name="envelope" type="envelopeType" />
|
| 30 |
<xsd:element name="body" type="bodyType" />
|
| 31 |
<xsd:element name="attachment" type="attachmentType"
|
| 32 |
minOccurs="0" maxOccurs="unbounded" />
|
| 33 |
</xsd:sequence>
|
| 34 |
<xsd:attribute use="required" name="id" type="xsd:integer" />
|
| 35 |
</xsd:complexType>
|
| 36 |
|
| 37 |
<xsd:element name="header">
|
| 38 |
<xsd:complexType>
|
| 39 |
<xsd:simpleContent>
|
| 40 |
<xsd:extension base="xsd:string">
|
| 41 |
<xsd:attribute ref="name" use="required" />
|
| 42 |
</xsd:extension>
|
| 43 |
</xsd:simpleContent>
|
| 44 |
</xsd:complexType>
|
| 45 |
</xsd:element>
|
| 46 |
|
| 47 |
<xsd:element name="Date" type="xsd:dateTime" />
|
| 48 |
|
| 49 |
<xsd:complexType name="envelopeType">
|
| 50 |
<xsd:sequence>
|
| 51 |
<xsd:element name="From" type="xsd:string" />
|
| 52 |
<xsd:element name="To" type="xsd:string" />
|
| 53 |
<xsd:element ref="Date" />
|
| 54 |
<xsd:element name="Subject" type="xsd:string" />
|
| 55 |
<xsd:element ref="header" minOccurs="0" maxOccurs="unbounded" />
|
| 56 |
</xsd:sequence>
|
| 57 |
<xsd:attribute name="From" type="xsd:string" use="required" />
|
| 58 |
</xsd:complexType>
|
| 59 |
|
| 60 |
<xsd:simpleType name="bodyType">
|
| 61 |
<xsd:restriction base="xsd:string" />
|
| 62 |
</xsd:simpleType>
|
| 63 |
|
| 64 |
<xsd:complexType name="attachmentType">
|
| 65 |
<xsd:group ref="attachmentContent" />
|
| 66 |
<xsd:attribute ref="name" use="required" />
|
| 67 |
</xsd:complexType>
|
| 68 |
|
| 69 |
<xsd:group name="attachmentContent">
|
| 70 |
<xsd:sequence>
|
| 71 |
<xsd:element name="mimetype">
|
| 72 |
<xsd:complexType>
|
| 73 |
<xsd:attributeGroup ref="mimeTypeAttributes" />
|
| 74 |
</xsd:complexType>
|
| 75 |
</xsd:element>
|
| 76 |
<xsd:element name="content" type="xsd:string" minOccurs="0" />
|
| 77 |
</xsd:sequence>
|
| 78 |
</xsd:group>
|
| 79 |
|
| 80 |
<xsd:attribute name="name" type="xsd:string" />
|
| 81 |
|
| 82 |
<xsd:attributeGroup name="mimeTypeAttributes">
|
| 83 |
<xsd:attribute name="type" type="mimeTopLevelType" use="required" />
|
| 84 |
<xsd:attribute name="subtype" type="xsd:string" use="required" />
|
| 85 |
</xsd:attributeGroup>
|
| 86 |
|
| 87 |
<xsd:simpleType name="mimeTopLevelType">
|
| 88 |
<xsd:restriction base="xsd:string">
|
| 89 |
<xsd:enumeration value="text" />
|
| 90 |
<xsd:enumeration value="multipart" />
|
| 91 |
<xsd:enumeration value="application" />
|
| 92 |
<xsd:enumeration value="message" />
|
| 93 |
<xsd:enumeration value="image" />
|
| 94 |
<xsd:enumeration value="audio" />
|
| 95 |
<xsd:enumeration value="video" />
|
| 96 |
</xsd:restriction>
|
| 97 |
</xsd:simpleType>
|
| 98 |
|
| 99 |
</xsd:schema>
|
| 100 |
]]></sample>
|
| 101 |
</box>
|
| 102 |
|
| 103 |
<box title="mails.xml" link="mails_xml">
|
| 104 |
<sample><![CDATA[
|
| 105 |
<!-- mails.xml -->
|
| 106 |
|
| 107 |
<mails>
|
| 108 |
<mail id="0">
|
| 109 |
<envelope From="bill@microsoft.com">
|
| 110 |
<From>user@unknown.domain.org</From>
|
| 111 |
<To>user@cduce.org</To>
|
| 112 |
<Date>2003-10-15T15:44:01Z</Date>
|
| 113 |
<Subject>I desperately need XML Schema support in CDuce</Subject>
|
| 114 |
<header name="Reply-To">bill@microsoft.com</header>
|
| 115 |
</envelope>
|
| 116 |
<body>
|
| 117 |
As subject says, is it possible to implement it?
|
| 118 |
</body>
|
| 119 |
<attachment name="signature.doc">
|
| 120 |
<mimetype type="application" subtype="msword"/>
|
| 121 |
<content>
|
| 122 |
### removed by spamoracle ###
|
| 123 |
</content>
|
| 124 |
</attachment>
|
| 125 |
</mail>
|
| 126 |
<mail id="1">
|
| 127 |
<envelope From="zack@cs.unibo.it">
|
| 128 |
<From>zack@di.ens.fr</From>
|
| 129 |
<To>bill@microsoft.com</To>
|
| 130 |
<Date>2003-10-15T16:17:39Z</Date>
|
| 131 |
<Subject>Re: I desperately need XML Schema support in CDuce</Subject>
|
| 132 |
</envelope>
|
| 133 |
<body>
|
| 134 |
user@unknown.domain.org wrote:
|
| 135 |
> As subject says, is possible to implement it?
|
| 136 |
|
| 137 |
Sure, I'm working on it, in a few years^Wdays it will be finished
|
| 138 |
</body>
|
| 139 |
</mail>
|
| 140 |
</mails>
|
| 141 |
]]></sample>
|
| 142 |
</box>
|
| 143 |
|
| 144 |
</page>
|