schemas/base.xsd schemas/contact.xsd schemas/incidence.xsd

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Sun Oct 23 18:42:05 CEST 2011


 schemas/base.xsd      |   74 ++++++++++++++++++++++--------
 schemas/contact.xsd   |   99 ++++++++++++++++++++---------------------
 schemas/incidence.xsd |  120 +++++++++++++++++---------------------------------
 3 files changed, 145 insertions(+), 148 deletions(-)

New commits:
commit b5cd74cebdeabf5fdc193b16b60bd4a0bb7cea2b
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Sun Oct 23 17:29:03 2011 +0100

    A couple of changes are included in this commit:
    
      - Tags with no content can be closed immediately <br /> style.
      - Leave no complexType definitions unnamed, or they end up as
        anonymous types. These anonymous types would otherwise be
        generated in a fashion that would ultimately become exclusive
        to one particular set of generated bindings.
    
        This moves a set of complexType definitions to the global
        space, and names them.
    
      - Replace empty default attribute values with minOccurs="0".
      - Apply consistent ordering of defined attributes;
    
          (name, type[, minOccurs[, maxOccurs]][, default][, fixed])
    
      - At the very least the phone number seems to be required in
        PhoneNumber abstract complexType definition.
    
      - Reverse order of display_name and smtp_address name element
        definitions in the SMTPContact complexType definition, as
        these logically become positioned arguments, while
        display_name is not mandatory and smtp_address is.

diff --git a/schemas/base.xsd b/schemas/base.xsd
index b41cfe8..18b0a9f 100644
--- a/schemas/base.xsd
+++ b/schemas/base.xsd
@@ -6,38 +6,63 @@
 
     <xs:complexType name="XMLBase" abstract="true">
         <xs:sequence>
-            <xs:element name="uid" type="UID"/>
-            <xs:element name="body" type="xs:string" default=""/>
-            <xs:element name="categories" type="Category" default=""/>
-            <xs:element name="creation-date" type="xs:dateTime"/>
-            <xs:element name="last-modification-date" type="xs:dateTime"/>
-            <xs:element name="sensitivity" type="Sensitivity" default="public"/>
-            <xs:element minOccurs="0" maxOccurs="unbounded"
-                name="inline-attachment" type="xs:string"/>
-            <xs:element minOccurs="0" maxOccurs="unbounded"
-                name="link-attachment" type="xs:string"/>
-            <xs:element name="product-id" type="xs:string" default=""/>
+            <!--
+                Mandatory elements
+            //-->
+            <xs:element name="uid" type="UID" />
+            <xs:element name="product-id" type="xs:string" />
+            <xs:element name="creation-date" type="xs:dateTime" />
+            <xs:element name="last-modification-date" type="xs:dateTime" />
+
+            <!--
+                Elements that do not require to be set by a client application,
+                as a default is provided.
+            //-->
+            <xs:element name="sensitivity" type="Sensitivity" default="public" />
+
+            <!--
+                Optional elements
+            //-->
+            <xs:element name="body" type="xs:string" minOccurs="0" />
+            <xs:element name="categories" type="Category" minOccurs="0" />
+            <xs:element name="inline-attachment" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
+            <xs:element name="link-attachment" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
         </xs:sequence>
-        <xs:attribute name="version" type="xs:double" default="1.0"/>
+
+        <!--
+            Version of the XML and bindings generated with this XSD.
+
+            Note: Does not seem to pass through to generated XML from PyXB
+            bindings.
+        //-->
+        <xs:attribute name="version" type="xs:string" fixed="3.0dev1" />
+
     </xs:complexType>
 
-     <xs:simpleType name="UID">
+    <xs:simpleType name="UID">
+        <!--
+            Note^1 that a UID restriction that is too short increases the risk of
+            duplicate UIDs.
+
+            Note^2 that we may also want to restrict the contents of the UID to
+            allow only alphanumeric characters.
+        //-->
         <xs:restriction base="xs:string">
-            <xs:minLength value="1"/>
-            <xs:whiteSpace value="collapse"/>
+            <xs:minLength value="1" />
+            <xs:whiteSpace value="collapse" />
         </xs:restriction>
     </xs:simpleType>
 
     <xs:simpleType name="Category">
         <xs:restriction base="xs:string">
-            <xs:pattern value="(\w+(,\w+)+)?"/>
+            <xs:pattern value="(\w+(,\w+)+)?" />
         </xs:restriction>
     </xs:simpleType>
 
     <xs:simpleType name="Color">
         <xs:restriction base="xs:string">
-            <xs:length value="7"/>
-            <xs:pattern value="#([a-f;0-9]){6}"/>
+            <xs:length value="7" />
+            <xs:pattern value="#([a-f;0-9]){6}" />
         </xs:restriction>
     </xs:simpleType>
 
@@ -51,10 +76,17 @@
 
     <xs:complexType name="SMTPContact">
         <xs:sequence>
-            <xs:element name="display-name" type="xs:string" default=""></xs:element>
-            <xs:element name="smtp-address" type="xs:string" default=""></xs:element>
+            <xs:element name="smtp-address" type="xs:string" />
+            <xs:element name="display-name" type="xs:string" minOccurs="0" />
         </xs:sequence>
     </xs:complexType>
 
-    <xs:attribute name="version" type="xs:float"/>
+    <!--
+        Version of the XML and bindings generated with this XSD.
+
+        Note: Does not seem to pass through to generated XML from PyXB
+        bindings.
+    //-->
+    <xs:attribute name="version" type="xs:string" fixed="3.0dev1" />
+
 </xs:schema>
\ No newline at end of file
diff --git a/schemas/contact.xsd b/schemas/contact.xsd
index dcac506..1b7c8fe 100644
--- a/schemas/contact.xsd
+++ b/schemas/contact.xsd
@@ -12,40 +12,31 @@
         <xs:complexContent>
             <xs:extension base="XMLBase">
                 <xs:sequence>
-                    <xs:element name="name" type="Name">
-                    </xs:element>
-                    <xs:element name="free-busy-url" type="xs:string" default=""></xs:element>
-                    <xs:element name="organization" type="xs:string" default=""></xs:element>
-                    <xs:element name="web-page" type="xs:string" default=""></xs:element>
-                    <xs:element name="im-address" type="xs:string" default=""></xs:element>
-                    <xs:element name="department" type="xs:string" default=""></xs:element>
-                    <xs:element name="office-location" type="xs:string" default=""></xs:element>
-                    <xs:element name="profession" type="xs:string" default=""></xs:element>
-                    <xs:element name="job-title" type="xs:string" default=""></xs:element>
-                    <xs:element name="manager-name" type="xs:string" default=""></xs:element>
-                    <xs:element name="assistant" type="xs:string" default=""></xs:element>
-                    <xs:element name="nick-name" type="xs:string" default=""></xs:element>
-                    <xs:element name="spouse-name" type="xs:string" default=""></xs:element>
-                    <xs:element name="birthday" type="xs:string" minOccurs="0"></xs:element>
-                    <xs:element name="anniversary" type="xs:string" minOccurs="0"></xs:element>
-                    <xs:element name="picture" type="xs:string" default=""></xs:element>
-                    <xs:element name="children" type="xs:string" default=""></xs:element>
-                    <xs:element name="gender" type="xs:string" default=""></xs:element>
-                    <xs:element name="language" type="xs:string" default=""></xs:element>
-                    <xs:element name="phone" maxOccurs="unbounded"
-                        minOccurs="0" type="PhoneNumber">
-                    </xs:element>
-                    <xs:element name="email" maxOccurs="unbounded"
-                        minOccurs="0" type="SMTPContact">
-                    </xs:element>
-                    <xs:element name="address" maxOccurs="unbounded"
-                        minOccurs="0" type="Address">
-                    </xs:element>
-                    <xs:element name="preferred-address"
-                        type="xs:string" minOccurs="0">
-                    </xs:element>
-                    <xs:element name="latitude" type="xs:float" minOccurs="0"></xs:element>
-                    <xs:element name="longitude" type="xs:float" minOccurs="0"></xs:element>
+                    <xs:element name="name" type="Name" minOccurs="0" />
+                    <xs:element name="free-busy-url" type="xs:string" minOccurs="0" />
+                    <xs:element name="organization" type="xs:string" minOccurs="0" />
+                    <xs:element name="web-page" type="xs:string" minOccurs="0" />
+                    <xs:element name="im-address" type="xs:string" minOccurs="0" />
+                    <xs:element name="department" type="xs:string" minOccurs="0" />
+                    <xs:element name="office-location" type="xs:string" minOccurs="0" />
+                    <xs:element name="profession" type="xs:string" minOccurs="0" />
+                    <xs:element name="job-title" type="xs:string" minOccurs="0" />
+                    <xs:element name="manager-name" type="xs:string" minOccurs="0" />
+                    <xs:element name="assistant" type="xs:string" minOccurs="0" />
+                    <xs:element name="nick-name" type="xs:string" minOccurs="0" />
+                    <xs:element name="spouse-name" type="xs:string" minOccurs="0" />
+                    <xs:element name="birthday" type="xs:string" minOccurs="0" />
+                    <xs:element name="anniversary" type="xs:string" minOccurs="0" />
+                    <xs:element name="picture" type="xs:string" minOccurs="0" />
+                    <xs:element name="children" type="xs:string" minOccurs="0" />
+                    <xs:element name="gender" type="xs:string" minOccurs="0" />
+                    <xs:element name="language" type="xs:string" minOccurs="0" />
+                    <xs:element name="phone" type="PhoneNumber" minOccurs="0" maxOccurs="unbounded" />
+                    <xs:element name="email" type="SMTPContact" minOccurs="0" maxOccurs="unbounded" />
+                    <xs:element name="address" type="Address" minOccurs="0" maxOccurs="unbounded" />
+                    <xs:element name="preferred-address" type="xs:string" minOccurs="0" />
+                    <xs:element name="latitude" type="xs:float" minOccurs="0" />
+                    <xs:element name="longitude" type="xs:float" minOccurs="0" />
                 </xs:sequence>
             </xs:extension>
         </xs:complexContent>
@@ -53,29 +44,39 @@
 
     <xs:complexType name="Name">
         <xs:sequence>
-            <xs:element name="given-name" type="xs:string" default=""></xs:element>
-            <xs:element name="middle-names" type="xs:string" default=""></xs:element>
-            <xs:element name="last-name" type="xs:string" default=""></xs:element>
-            <xs:element name="full-name" type="xs:string" default=""></xs:element>
-            <xs:element name="initials" type="xs:string" default=""></xs:element>
-            <xs:element name="prefix" type="xs:string" default=""></xs:element>
-            <xs:element name="suffix" type="xs:string" default=""></xs:element>
+            <xs:element name="given-name" type="xs:string" minOccurs="0" />
+            <xs:element name="middle-names" type="xs:string" minOccurs="0" />
+            <xs:element name="last-name" type="xs:string" minOccurs="0" />
+            <xs:element name="full-name" type="xs:string" minOccurs="0" />
+            <xs:element name="initials" type="xs:string" minOccurs="0" />
+            <xs:element name="prefix" type="xs:string" minOccurs="0" />
+            <xs:element name="suffix" type="xs:string" minOccurs="0" />
         </xs:sequence>
     </xs:complexType>
+
     <xs:complexType name="PhoneNumber">
         <xs:sequence>
-            <xs:element name="type" type="xs:string" minOccurs="0"></xs:element>
-            <xs:element name="number" type="xs:string" default=""></xs:element>
+            <xs:element name="type" type="xs:string" minOccurs="0" />
+            <xs:element name="number" type="xs:string" />
         </xs:sequence>
     </xs:complexType>
+
     <xs:complexType name="Address">
+        <!--
+            'type' is a reserved keyword... can we use 'label' instead, perhaps?
+
+            Note: I have not actually experienced any trouble with this yet.
+        //-->
         <xs:sequence>
-            <xs:element name="type" type="xs:string" default="home"></xs:element>
-            <xs:element name="street" type="xs:string" default=""></xs:element>
-            <xs:element name="locality" type="xs:string" default=""></xs:element>
-            <xs:element name="region" type="xs:string" default=""></xs:element>
-            <xs:element name="postal-code" type="xs:string" default=""></xs:element>
-            <xs:element name="country" type="xs:string" default=""></xs:element>
+            <xs:element name="type" type="xs:string" default="home" />
+            <xs:element name="street" type="xs:string" minOccurs="0" />
+            <xs:element name="postal-code" type="xs:string" minOccurs="0" />
+            <!--
+                Is locality supposed to mean city?
+            //-->
+            <xs:element name="locality" type="xs:string" minOccurs="0" />
+            <xs:element name="region" type="xs:string" minOccurs="0" />
+            <xs:element name="country" type="xs:string" minOccurs="0" />
         </xs:sequence>
     </xs:complexType>
 </xs:schema>
\ No newline at end of file
diff --git a/schemas/incidence.xsd b/schemas/incidence.xsd
index 904f4ad..86436af 100644
--- a/schemas/incidence.xsd
+++ b/schemas/incidence.xsd
@@ -12,73 +12,53 @@
                 <xs:sequence>
                     <xs:element name="summary" type="xs:string" />
                     <xs:element name="location" type="xs:string" />
-                    <xs:element name="creator" type="SMTPContact">
+                    <xs:element name="creator" type="SMTPContact" />
+                    <xs:element name="organizer" type="SMTPContact" />
+                    <xs:element name="alarm" type="xs:string" />
+                    <xs:element name="recurrence" type="Recurrence" />
+                    <xs:element name="attendee" type="Attendee" />
+                </xs:sequence>
+            </xs:extension>
+        </xs:complexContent>
+    </xs:complexType>
 
-                    </xs:element>
-                    <xs:element name="organizer" type="SMTPContact"></xs:element>
-                    <xs:element name="alarm" type="xs:string"></xs:element>
-                    <xs:element name="recurrence">
-                        <xs:complexType>
-                            <xs:sequence>
-                                <xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"></xs:any>
-                            </xs:sequence>
-                            <xs:attribute name="cycle" type="xs:string">
-                            </xs:attribute>
-                        </xs:complexType>
-                    </xs:element>
-                    <xs:element name="attendee">
-                        <xs:complexType>
-                            <xs:complexContent>
-                                <xs:extension base="SMTPContact">
-                                    <xs:sequence>
-                                        <xs:element name="status" type="xs:string">
-                                        </xs:element>
-                                        <xs:element name="request-response" type="xs:string">
-                                        </xs:element>
-                                        <xs:element name="role" type="xs:string">
-                                        </xs:element>
-                                    </xs:sequence>
-                                </xs:extension>
-                            </xs:complexContent>
-                        </xs:complexType>
-                    </xs:element>
+    <xs:complexType name="Attendee" abstract="true">
+        <xs:complexContent>
+            <xs:extension base="SMTPContact">
+                <xs:sequence>
+                    <xs:element name="status" type="xs:string" />
+                    <xs:element name="request-response" type="xs:string" />
+                    <xs:element name="role" type="xs:string" />
                 </xs:sequence>
             </xs:extension>
         </xs:complexContent>
     </xs:complexType>
 
-    <xs:simpleType name="NewSimpleType">
+    <xs:simpleType name="Cycle">
         <xs:restriction base="xs:string">
-            <xs:enumeration value="daily"></xs:enumeration>
-            <xs:enumeration value="weekly"></xs:enumeration>
-            <xs:enumeration value="monthly"></xs:enumeration>
-            <xs:enumeration value="yearly"></xs:enumeration>
+            <xs:enumeration value="daily" />
+            <xs:enumeration value="weekly" />
+            <xs:enumeration value="monthly" />
+            <xs:enumeration value="yearly" />
         </xs:restriction>
     </xs:simpleType>
 
     <xs:complexType name="Recurrence" abstract="true">
         <xs:sequence>
-            <xs:element name="interval" type="xs:string">
-            </xs:element>
-            <xs:element name="rangetype">
-                <xs:complexType>
-                    <xs:attribute name="type" type="xs:string">
-                    </xs:attribute>
-                </xs:complexType>
-            </xs:element>
-            <xs:element name="exclusion" type="xs:string" maxOccurs="unbounded"
-                minOccurs="0">
-            </xs:element>
+            <xs:element name="interval" type="xs:string" />
+            <xs:element name="exclusion" type="xs:string" maxOccurs="unbounded" minOccurs="0" />
+            <xs:element name="rangetype" type="RecurrenceType" />
         </xs:sequence>
     </xs:complexType>
 
+    <xs:complexType name="RecurrenceType" abstract="true">
+        <xs:attribute name="type" type="xs:string" />
+    </xs:complexType>
 
     <xs:complexType name="DailyRecurrence">
         <xs:complexContent>
             <xs:extension base="Recurrence">
-                <xs:attribute name="cycle" type="xs:string" fixed="daily"
-                    use="required">
-                </xs:attribute>
+                <xs:attribute name="cycle" type="xs:string" fixed="daily" use="required" />
             </xs:extension>
         </xs:complexContent>
     </xs:complexType>
@@ -86,9 +66,7 @@
     <xs:complexType name="WeeklyRecurrence">
         <xs:complexContent>
             <xs:extension base="Recurrence">
-                <xs:attribute name="cycle" type="xs:string" fixed="weekly"
-                    use="required">
-                </xs:attribute>
+                <xs:attribute name="cycle" type="xs:string" fixed="weekly" use="required" />
             </xs:extension>
         </xs:complexContent>
     </xs:complexType>
@@ -104,11 +82,8 @@
                     <xs:element name="daynumber" type="xs:string">
                     </xs:element>
                 </xs:sequence>
-                <xs:attribute name="cycle" type="xs:string" fixed="monthly"
-                    use="required">
-                </xs:attribute>
-                <xs:attribute name="type" type="xs:string" use="required">
-                </xs:attribute>
+                <xs:attribute name="cycle" type="xs:string" fixed="monthly" use="required" />
+                <xs:attribute name="type" type="xs:string" use="required" />
             </xs:extension>
         </xs:complexContent>
     </xs:complexType>
@@ -117,29 +92,18 @@
         <xs:complexContent>
             <xs:extension base="Recurrence">
                 <xs:sequence>
-                    <xs:element name="interval" type="xs:string">
-                    </xs:element>
-                    <xs:element name="day" type="xs:string">
-                    </xs:element>
-                    <xs:element name="daynumber" type="xs:string">
-                    </xs:element>
-                    <xs:element name="month" type="xs:string">
-                    </xs:element>
+                    <xs:element name="interval" type="xs:string" />
+                    <xs:element name="day" type="xs:string" />
+                    <xs:element name="daynumber" type="xs:string" />
+                    <xs:element name="month" type="xs:string" />
                 </xs:sequence>
-                <xs:attribute name="cycle" type="xs:string" fixed="yearly"
-                    use="required">
-                </xs:attribute>
-                <xs:attribute name="type" use="required">
-                    <xs:simpleType>
-                        <xs:restriction base="xs:string">
-                            <xs:enumeration value="monthday">
-                            </xs:enumeration>
-                            <xs:enumeration value="yearday">
-                            </xs:enumeration>
-                            <xs:enumeration value="weekday">
-                            </xs:enumeration>
-                        </xs:restriction>
-                    </xs:simpleType>
+                <xs:attribute name="cycle" type="xs:string" fixed="yearly" use="required" />
+                <xs:attribute name="type" type="xs:string" use="required">
+                    <xs:restriction base="xs:string">
+                        <xs:enumeration value="monthday" />
+                        <xs:enumeration value="yearday" />
+                        <xs:enumeration value="weekday" />
+                    </xs:restriction>
                 </xs:attribute>
             </xs:extension>
         </xs:complexContent>





More information about the commits mailing list