xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkro...@apache.org
Subject svn commit: r155980 - in xmlbeans/trunk/test: cases/xbean/scomp/contentType/UnionType.xsd src/xmlobject/schematypes/checkin/EnumTests.java
Date Thu, 03 Mar 2005 00:25:53 GMT
Author: kkrouse
Date: Wed Mar  2 16:25:52 2005
New Revision: 155980

URL: http://svn.apache.org/viewcvs?view=rev&rev=155980
Log:
- The type 'GlobalSImpleT1' in UnionType.xsd was excluding "1" from it's
  range.  This caused UnionRestriction.xsd to fail to compile now that
  enumerations are properly validated against the base type.

- Added test case to ensure string enumerations are validated against the base type


Modified:
    xmlbeans/trunk/test/cases/xbean/scomp/contentType/UnionType.xsd
    xmlbeans/trunk/test/src/xmlobject/schematypes/checkin/EnumTests.java

Modified: xmlbeans/trunk/test/cases/xbean/scomp/contentType/UnionType.xsd
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/cases/xbean/scomp/contentType/UnionType.xsd?view=diff&r1=155979&r2=155980
==============================================================================
--- xmlbeans/trunk/test/cases/xbean/scomp/contentType/UnionType.xsd (original)
+++ xmlbeans/trunk/test/cases/xbean/scomp/contentType/UnionType.xsd Wed Mar  2 16:25:52 2005
@@ -7,7 +7,7 @@
 >
     <xsd:simpleType name="GlobalSimpleT1">
         <xsd:restriction base="xsd:integer">
-            <xsd:minExclusive value="1"/>
+            <xsd:minInclusive value="1"/>
             <xsd:maxInclusive value="3"/>
         </xsd:restriction>
     </xsd:simpleType>
@@ -56,4 +56,4 @@
     <xsd:element name="UnionElt" type="UnionAnonGlobalT"/>
     <xsd:element name="UnionOfUnions" type="UnionOfUnionsT"/>
     <xsd:element name="UnionOfLists" type="UnionOfListsT"/>
-</xsd:schema>
\ No newline at end of file
+</xsd:schema>

Modified: xmlbeans/trunk/test/src/xmlobject/schematypes/checkin/EnumTests.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/test/src/xmlobject/schematypes/checkin/EnumTests.java?view=diff&r1=155979&r2=155980
==============================================================================
--- xmlbeans/trunk/test/src/xmlobject/schematypes/checkin/EnumTests.java (original)
+++ xmlbeans/trunk/test/src/xmlobject/schematypes/checkin/EnumTests.java Wed Mar  2 16:25:52
2005
@@ -19,6 +19,8 @@
 import junit.framework.TestSuite;
 import junit.framework.Assert;
 import junit.framework.TestCase;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 import com.enumtest.StatusreportDocument;
 import com.enumtest.SalesreportDocument;
@@ -135,5 +137,44 @@
         }
     }
 
+    public static void testEnumRestriction() throws Exception
+    {
+        String schema =
+            "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\n" +
+            "    xmlns:tns=\"foo\" targetNamespace=\"foo\">\n" +
+            "\n" +
+            "    <xs:simpleType name=\"parent\">\n" +
+            "        <xs:restriction base=\"xs:string\">\n" +
+            "            <xs:enumeration value=\"abc\"/>\n" +
+            "            <xs:enumeration value=\"123\"/>\n" +
+            "        </xs:restriction>\n" +
+            "    </xs:simpleType>\n" +
+            "\n" +
+            "    <xs:simpleType name=\"child\">\n" +
+            "        <xs:restriction base=\"tns:parent\">\n" +
+            "            <xs:enumeration value=\"abc\"/>\n" +
+            "            <xs:enumeration value=\"123\"/>\n" +
+                         // 'xyz' is an invalid enumeration value
+            "            <xs:enumeration value=\"xyz\"/>\n" +
+            "        </xs:restriction>\n" +
+            "    </xs:simpleType>\n" +
+            "\n" +
+            "</xs:schema>\n";
+
+        XmlObject xobj = XmlObject.Factory.parse(schema);
+        //ArrayList errors = new ArrayList();
+        //XmlOptions opts = new XmlOptions().setErrorListener(errors);
+
+        try
+        {
+            XmlBeans.loadXsd(new XmlObject[]{xobj});
+            fail("Expected loadXsd() to throw an exception.");
+        }
+        catch (XmlException xe)
+        {
+            //
+            System.out.println("caught: " + xe);
+        }
+    }
 
 }



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


Mime
View raw message