Circular dependency removal in xml schema
authorTomasz Iwanek <t.iwanek@samsung.com>
Mon, 17 Jun 2013 07:44:52 +0000 (09:44 +0200)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Sat, 22 Jun 2013 13:03:24 +0000 (13:03 +0000)
[Issue#]       LINUXWRT-457
[Bug]          Tizen IDE requires no circular dependecies in xml schema
               Missing namespace for elements.
               Using import instead of include.
               Ambiquitious model for foreign element in widget element (it just cannot be expressed...)
[Cause]        N/A
[Solution]     Move conflict part to new xsd file
[Verification] run on PC: xmlstarlet val -e -s configuration/widgets.xsd configuration/config.xml.
Check xml schema for IDE:
- Run eclipse (Java EE edition!).
- Create Project of type of "XSD Schema File".
- Copy xsd files to project.
- Right click on widgets.xsd file in Project Explorer view.
- Choose "Validate" menuitem.
- No errors should appear.

Change-Id: I894a70c2548fc667c0a78ecde880e95b7b8fe4b7

configuration/access.xsd
configuration/common.xsd
configuration/local.xsd [new file with mode: 0644]
configuration/packaging-configuration.xsd
configuration/updates.xsd
configuration/widgets.xsd

index 36d2937..f2404e4 100644 (file)
@@ -1,14 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.w3.org/ns/widgets" xmlns:widgets="http://www.w3.org/ns/widgets">
-  <xs:import schemaLocation="common.xsd"/>
+  <xs:include schemaLocation="common.xsd"/>
   <!--
     Widget Access Request Policy <http://www.w3.org/TR/widgets-access/>
     requires common.rnc
   -->
   <xs:element name="access">
     <xs:complexType mixed="true">
-      <xs:attributeGroup ref="global.attrs"/>
-      <xs:attributeGroup ref="foreignAttribute"/>
+      <xs:attributeGroup ref="widgets:global.attrs"/>
+      <xs:attributeGroup ref="widgets:foreignAttribute"/>
       <xs:attribute name="origin" type="xs:string"/>
       <!-- w3c policy testcases
       <xs:attribute name="origin" use="required">
@@ -23,7 +23,7 @@
         </xs:simpleType>
       </xs:attribute>
       -->
-      <xs:attribute name="subdomains" type="data.boolean"/>
+      <xs:attribute name="subdomains" type="widgets:data.boolean"/>
     </xs:complexType>
   </xs:element>
 </xs:schema>
index 2ce2f7c..24d7283 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:widgets="http://www.w3.org/ns/widgets">
-  <xs:import namespace="http://www.w3.org/ns/widgets" schemaLocation="widgets.xsd"/>
+  <xs:include schemaLocation="local.xsd"/>
 
   <xs:group name="extension">
     <xs:sequence>
@@ -15,7 +15,7 @@
   <xs:group name="foreignElement">
     <xs:sequence>
       <xs:choice minOccurs="0">
-        <xs:group ref="widgets:local"/>
+        <xs:group ref="local"/>
       </xs:choice>
     </xs:sequence>
   </xs:group>
diff --git a/configuration/local.xsd b/configuration/local.xsd
new file mode 100644 (file)
index 0000000..4aecb7d
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:widgets="http://www.w3.org/ns/widgets">
+    <xs:group name="local">
+        <xs:sequence>
+            <xs:any namespace="##other" processContents="skip"/>
+        </xs:sequence>
+    </xs:group>
+</xs:schema>
index bb130eb..de55b49 100644 (file)
@@ -1,6 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.w3.org/ns/widgets" xmlns:widgets="http://www.w3.org/ns/widgets">
-  <xs:import schemaLocation="common.xsd"/>
+  <xs:include schemaLocation="common.xsd"/>
+  <xs:include schemaLocation="access.xsd"/>
+  <xs:include schemaLocation="updates.xsd"/>
   <xs:import namespace="http://tizen.org/ns/widgets" schemaLocation="widgets.tizen.xsd"/>
   <!--
     Widget Packaging and Configuration <http://www.w3.org/TR/widgets/>
     <xs:complexType>
       <xs:complexContent>
         <xs:extension base="widgets:group.widgetContent">
-          <xs:attributeGroup ref="global.attrs"/>
-          <xs:attributeGroup ref="global.xml"/>
-          <xs:attributeGroup ref="extension"/>
+          <xs:attributeGroup ref="widgets:global.attrs"/>
+          <xs:attributeGroup ref="widgets:global.xml"/>
+          <xs:attributeGroup ref="widgets:extension"/>
           <xs:attribute name="id" type="xs:anyURI"/>
           <xs:attribute name="defaultlocale"/>
           <xs:attribute name="version"/>
-          <xs:attribute name="min-version" type="data.versionNumber"/>
-          <xs:attribute name="height" type="data.positiveNumber"/>
-          <xs:attribute name="width" type="data.positiveNumber"/>
+          <xs:attribute name="min-version" type="widgets:data.versionNumber"/>
+          <xs:attribute name="height" type="widgets:data.positiveNumber"/>
+          <xs:attribute name="width" type="widgets:data.positiveNumber"/>
           <xs:attribute name="viewmodes">
             <xs:simpleType>
               <xs:list>
         <xs:element ref="tizen:app-widget"  minOccurs="0" maxOccurs="unbounded" xmlns:tizen="http://tizen.org/ns/widgets"/>
         <xs:element ref="tizen:account"  minOccurs="0" maxOccurs="unbounded" xmlns:tizen="http://tizen.org/ns/widgets"/>
         <xs:element ref="tizen:metadata"  minOccurs="0" maxOccurs="unbounded" xmlns:tizen="http://tizen.org/ns/widgets"/>
-        <xs:group ref="foreignElement"/>
+        <xs:element ref="tizen:splash"  minOccurs="0" maxOccurs="1" xmlns:tizen="http://tizen.org/ns/widgets"/>
         <!-- W3C testcases fail - should accept any element -->
+        <!--  <xs:group minOccurs="0" maxOccurs="unbounded" ref="widgets:foreignElement"/> -->
       </xs:choice>
       <xs:element ref="widgets:access"/>
-      <xs:element ref="widgets:update-description"/>
+      <!--   <xs:element ref="widgets:update-description"/> -->
     </xs:choice>
   </xs:complexType>
   <xs:element name="name">
     <xs:complexType mixed="true">
       <xs:choice minOccurs="0" maxOccurs="unbounded">
         <xs:element ref="widgets:span"/>
-        <xs:group ref="foreignElement"/>
+        <xs:group ref="widgets:foreignElement"/>
       </xs:choice>
-      <xs:attributeGroup ref="global.attrs"/>
-      <xs:attributeGroup ref="global.xml"/>
-      <xs:attributeGroup ref="extension"/>
+      <xs:attributeGroup ref="widgets:global.attrs"/>
+      <xs:attributeGroup ref="widgets:global.xml"/>
+      <xs:attributeGroup ref="widgets:extension"/>
       <xs:attribute name="short"/>
     </xs:complexType>
   </xs:element>
     <xs:complexType mixed="true">
       <xs:choice minOccurs="0" maxOccurs="unbounded">
         <xs:element ref="widgets:span"/>
-        <xs:group ref="foreignElement"/>
+        <xs:group ref="widgets:foreignElement"/>
       </xs:choice>
-      <xs:attributeGroup ref="global.attrs"/>
-      <xs:attributeGroup ref="global.xml"/>
-      <xs:attributeGroup ref="extension"/>
+      <xs:attributeGroup ref="widgets:global.attrs"/>
+      <xs:attributeGroup ref="widgets:global.xml"/>
+      <xs:attributeGroup ref="widgets:extension"/>
     </xs:complexType>
   </xs:element>
   <xs:element name="icon">
     <xs:complexType>
-      <xs:attributeGroup ref="global.attrs"/>
-      <xs:attributeGroup ref="foreignAttribute"/>
+      <xs:attributeGroup ref="widgets:global.attrs"/>
+      <xs:attributeGroup ref="widgets:foreignAttribute"/>
       <!-- w3c testcase - must ignore
       <xs:attribute name="src" use="required" type="xs:anyURI"/>
       -->
       <xs:attribute name="src" type="xs:anyURI"/>
-      <xs:attribute name="height" type="data.positiveNumber"/>
-      <xs:attribute name="width" type="data.positiveNumber"/>
+      <xs:attribute name="height" type="widgets:data.positiveNumber"/>
+      <xs:attribute name="width" type="widgets:data.positiveNumber"/>
     </xs:complexType>
   </xs:element>
   <xs:element name="author">
     <xs:complexType mixed="true">
       <xs:choice minOccurs="0" maxOccurs="unbounded">
         <xs:element ref="widgets:span"/>
-        <xs:group ref="foreignElement"/>
+        <xs:group ref="widgets:foreignElement"/>
         <!-- W3C testcases fail - should accept any element -->
       </xs:choice>
-      <xs:attributeGroup ref="global.attrs"/>
-      <xs:attributeGroup ref="global.xml"/>
-      <xs:attributeGroup ref="extension"/>
+      <xs:attributeGroup ref="widgets:global.attrs"/>
+      <xs:attributeGroup ref="widgets:global.xml"/>
+      <xs:attributeGroup ref="widgets:extension"/>
       <xs:attribute name="href" type="xs:anyURI"/>
       <xs:attribute name="email" type="xs:string"/>
       <!-- fails W3C testcases
     <xs:complexType mixed="true">
       <xs:choice minOccurs="0" maxOccurs="unbounded">
         <xs:element ref="widgets:span"/>
-        <xs:group ref="foreignElement"/>
+        <xs:group ref="widgets:foreignElement"/>
       </xs:choice>
-      <xs:attributeGroup ref="global.attrs"/>
-      <xs:attributeGroup ref="global.xml"/>
-      <xs:attributeGroup ref="extension"/>
+      <xs:attributeGroup ref="widgets:global.attrs"/>
+      <xs:attributeGroup ref="widgets:global.xml"/>
+      <xs:attributeGroup ref="widgets:extension"/>
       <xs:attribute name="href" type="xs:anyURI"/>
     </xs:complexType>
   </xs:element>
   <xs:element name="content">
     <xs:complexType>
-      <xs:attributeGroup ref="global.attrs"/>
-      <xs:attributeGroup ref="foreignAttribute"/>
+      <xs:attributeGroup ref="widgets:global.attrs"/>
+      <xs:attributeGroup ref="widgets:foreignAttribute"/>
       <!-- w3c testcase - ignore not valid
       <xs:attribute name="src" use="required" type="xs:anyURI"/>
       -->
     <xs:complexType mixed="true">
       <xs:choice minOccurs="0" maxOccurs="unbounded">
         <xs:element ref="widgets:param"/>
-        <xs:group ref="foreignElement"/>
+        <xs:group ref="widgets:foreignElement"/>
       </xs:choice>
-      <xs:attributeGroup ref="global.attrs"/>
-      <xs:attributeGroup ref="global.xml"/>
-      <xs:attributeGroup ref="extension"/>
+      <xs:attributeGroup ref="widgets:global.attrs"/>
+      <xs:attributeGroup ref="widgets:global.xml"/>
+      <xs:attributeGroup ref="widgets:extension"/>
       <!-- w3c tescase - must ignore
       <xs:attribute name="name" use="required" type="xs:anyURI"/>
       -->
       <xs:attribute name="name" type="xs:anyURI"/>
-      <xs:attribute name="required" type="data.boolean"/>
+      <xs:attribute name="required" type="widgets:data.boolean"/>
     </xs:complexType>
   </xs:element>
   <xs:element name="param">
     <xs:complexType mixed="true">
-      <xs:group minOccurs="0" maxOccurs="unbounded" ref="foreignElement"/>
-      <xs:attributeGroup ref="global.attrs"/>
-      <xs:attributeGroup ref="global.xml"/>
-      <xs:attributeGroup ref="extension"/>
+      <xs:group minOccurs="0" maxOccurs="unbounded" ref="widgets:foreignElement"/>
+      <xs:attributeGroup ref="widgets:global.attrs"/>
+      <xs:attributeGroup ref="widgets:global.xml"/>
+      <xs:attributeGroup ref="widgets:extension"/>
       <xs:attribute name="name"/>
       <xs:attribute name="value"/>
       <!-- w3c testcase - must ignore
     <xs:complexType mixed="true">
       <xs:choice minOccurs="0" maxOccurs="unbounded">
         <xs:element ref="widgets:span"/>
-        <xs:group ref="foreignElement"/>
+        <xs:group ref="widgets:foreignElement"/>
       </xs:choice>
-      <xs:attributeGroup ref="global.attrs"/>
-      <xs:attributeGroup ref="global.xml"/>
+      <xs:attributeGroup ref="widgets:global.attrs"/>
+      <xs:attributeGroup ref="widgets:global.xml"/>
     </xs:complexType>
   </xs:element>
   <xs:element name="preference">
     <xs:complexType mixed="true">
-      <xs:group minOccurs="0" maxOccurs="unbounded" ref="foreignElement"/>
-      <xs:attributeGroup ref="global.attrs"/>
-      <xs:attributeGroup ref="global.xml"/>
-      <xs:attributeGroup ref="extension"/>
+      <xs:group minOccurs="0" maxOccurs="unbounded" ref="widgets:foreignElement"/>
+      <xs:attributeGroup ref="widgets:global.attrs"/>
+      <xs:attributeGroup ref="widgets:global.xml"/>
+      <xs:attributeGroup ref="widgets:extension"/>
       <!-- w3c testcase -required but missing
       <xs:attribute name="name" use="required"/>
       -->
       <xs:attribute name="name"/>
       <xs:attribute name="value"/>
-      <xs:attribute name="readonly" type="data.boolean"/>
+      <xs:attribute name="readonly" type="widgets:data.boolean"/>
     </xs:complexType>
   </xs:element>
 </xs:schema>
index 6be386b..6e6d88a 100644 (file)
@@ -1,14 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.w3.org/ns/widgets" xmlns:widgets="http://www.w3.org/ns/widgets">
-    <xs:import schemaLocation="common.xsd"/>
+    <xs:include schemaLocation="common.xsd"/>
     <!--
     Widget Updates <http://www.w3.org/TR/widgets-updates/>
     requires common.rnc
     -->
     <xs:element name="update-description">
     <xs:complexType mixed="true">
-        <xs:group minOccurs="0" maxOccurs="unbounded" ref="foreignElement"/>
-        <xs:attributeGroup ref="foreignAttribute"/>
+        <xs:group minOccurs="0" maxOccurs="unbounded" ref="widgets:foreignElement"/>
+        <xs:attributeGroup ref="widgets:foreignAttribute"/>
         <xs:attribute name="href" use="required" type="xs:anyURI"/>
     </xs:complexType>
     </xs:element>
index 839fa03..8de2f3d 100644 (file)
 -->
 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.w3.org/ns/widgets" xmlns:widgets="http://www.w3.org/ns/widgets">
     <xs:include schemaLocation="packaging-configuration.xsd"/>
-    <xs:include schemaLocation="access.xsd"/>
-    <xs:include schemaLocation="updates.xsd"/>
     <xs:import schemaLocation="common.xsd"/>
-    <xs:group name="local">
-        <xs:sequence>
-            <xs:any namespace="##other" processContents="skip"/>
-        </xs:sequence>
-    </xs:group>
 </xs:schema>