xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ce...@apache.org
Subject svn commit: r156985 - in xmlbeans/trunk/test: cases/xbean/scomp/idConstraints/Constraint.xsd src/scomp/elements/detailed/GlobalEltNillable.java src/scomp/idConstraint/detailed/KeyKeyref.java
Date Thu, 10 Mar 2005 19:42:12 GMT
Author: cezar
Date: Thu Mar 10 11:42:10 2005
New Revision: 156985

URL: http://svn.apache.org/viewcvs?view=rev&rev=156985
Log:
Contributed by Rajiv Balachandran - fixed some existing schema compilation test cases

Modified:
    xmlbeans/trunk/test/cases/xbean/scomp/idConstraints/Constraint.xsd
    xmlbeans/trunk/test/src/scomp/elements/detailed/GlobalEltNillable.java
    xmlbeans/trunk/test/src/scomp/idConstraint/detailed/KeyKeyref.java

Modified: xmlbeans/trunk/test/cases/xbean/scomp/idConstraints/Constraint.xsd
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/cases/xbean/scomp/idConstraints/Constraint.xsd?view=diff&r1=156984&r2=156985
==============================================================================
--- xmlbeans/trunk/test/cases/xbean/scomp/idConstraints/Constraint.xsd (original)
+++ xmlbeans/trunk/test/cases/xbean/scomp/idConstraints/Constraint.xsd Thu Mar 10 11:42:10
2005
@@ -50,14 +50,7 @@
         </xsd:unique>
     </xsd:element>
 
-    <xsd:element name="KeyProductList" type="OtherProductListType">
-        <xsd:unique name="deptProdKey">
-            <xsd:selector xpath="con:product"/>
-            <xsd:field xpath="con:department/@con:name"/>
-            <xsd:field xpath="con:id"/>
-        </xsd:unique>
-    </xsd:element>
-
+    <xsd:element name="KeyProductList" type="OtherProductListType" />
 
     <xsd:complexType name="OrderType">
         <xsd:sequence>
@@ -65,8 +58,8 @@
             <xsd:sequence maxOccurs="unbounded">
                 <xsd:element name="item">
                     <xsd:complexType>
-                         <xsd:attribute name="SKU"/>
-                         <xsd:attribute name="deptId"/>
+                        <xsd:attribute name="SKU" type="xsd:token"/>
+                        <xsd:attribute name="deptId"/>
                     </xsd:complexType>
                 </xsd:element>
             </xsd:sequence>
@@ -79,17 +72,24 @@
             <xsd:sequence>
                 <xsd:element ref="KeyProductList"/>
                 <xsd:sequence maxOccurs="unbounded">
-                    <xsd:element name="order" type="OrderType">
-                        <xsd:keyref name="ProdRef" refer="deptProdKey">
-                            <xsd:selector xpath="con:item"/>
-                            <xsd:field xpath="@con:deptId"/>
-                            <xsd:field xpath="@con:SKU"/>
-                        </xsd:keyref>
-                    </xsd:element>
+                    <xsd:element name="order" type="OrderType" />
                 </xsd:sequence>
             </xsd:sequence>
         </xsd:complexType>
+
+        <xsd:keyref name="ProdRef" refer="deptProdKey">
+            <xsd:selector xpath="con:order/con:item"/>
+            <xsd:field xpath="@con:deptId"/>
+            <xsd:field xpath="@con:SKU"/>
+        </xsd:keyref>
+
+        <xsd:key name="deptProdKey">
+            <xsd:selector xpath="con:KeyProductList/con:product"/>
+            <xsd:field xpath="con:department/@con:name"/>
+            <xsd:field xpath="con:id"/>
+        </xsd:key>
+
     </xsd:element>
 
 
-</xsd:schema>
\ No newline at end of file
+</xsd:schema>

Modified: xmlbeans/trunk/test/src/scomp/elements/detailed/GlobalEltNillable.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/scomp/elements/detailed/GlobalEltNillable.java?view=diff&r1=156984&r2=156985
==============================================================================
--- xmlbeans/trunk/test/src/scomp/elements/detailed/GlobalEltNillable.java (original)
+++ xmlbeans/trunk/test/src/scomp/elements/detailed/GlobalEltNillable.java Thu Mar 10 11:42:10
2005
@@ -93,6 +93,7 @@
         GlobalEltNillableFixedDocument testElt = GlobalEltNillableFixedDocument
                 .Factory.parse("<GlobalEltNillableFixed" +
                 "   xmlns=\"http://xbean/scomp/element/GlobalEltNillable\"" +
+                "  xsi:nillable=\"true\"" +
                 "/>");
         assertTrue(!testElt.validate(validateOptions));
         assertEquals(1, errorList.size());

Modified: xmlbeans/trunk/test/src/scomp/idConstraint/detailed/KeyKeyref.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/scomp/idConstraint/detailed/KeyKeyref.java?view=diff&r1=156984&r2=156985
==============================================================================
--- xmlbeans/trunk/test/src/scomp/idConstraint/detailed/KeyKeyref.java (original)
+++ xmlbeans/trunk/test/src/scomp/idConstraint/detailed/KeyKeyref.java Thu Mar 10 11:42:10
2005
@@ -206,7 +206,9 @@
 
     }
 
-    //ref non-existing key
+    // Invalid xml instance with 2 problems :
+    // a) the values for the key & key ref elems are not the same
+    // b) The keyref/key elems are duplicated
     public void testKeyRefIllegal() throws Throwable {
 
         String input =
@@ -216,21 +218,21 @@
                 " <con:department con:name=\"Marketing\"/>" +
                 " <con:id>FooBarChart</con:id>" +
                 "</con:product>" +
-                "<con:product>" +
-                " <con:department con:name=\"7345\"/>" +
+                " <con:product>" +
+                " <con:department con:name=\"Marketing\"/>" +
                 " <con:id>FooBarChart</con:id>" +
                 "</con:product>" +
                 "</con:KeyProductList>" +
                 "<con:order>" +
                 "   <con:customerName>Bozo</con:customerName>" +
                 "   <con:item con:deptId=\"7345\"" +
-                "   con:SKU=\"FooBarChart\">" +
+                "   con:SKU=\"ID1\">" +
                 "  </con:item>" +
                 "</con:order>" +
                 "<con:order>" +
-                "   <con:customerName>Marketing</con:customerName>" +
+                "   <con:customerName>Bozo</con:customerName>" +
                 "   <con:item con:deptId=\"7345\"" +
-                "   con:SKU=\"FooBarChart\">" +
+                "   con:SKU=\"ID1\">" +
                 "  </con:item>" +
                 "</con:order>" +
                 "</con:CompanyDB>";
@@ -239,7 +241,7 @@
         assertTrue(!doc.validate(validateOptions));
         showErrors();
         String[] errExpected = new String[]{
-            XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID
+            XmlErrorCodes.IDENTITY_CONSTRAINT_VALID$DUPLICATE_KEY
         };
         assertTrue(compareErrorCodes(errExpected));
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org


Mime
View raw message