You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by da...@apache.org on 2004/01/24 02:01:49 UTC
cvs commit: xml-xmlbeans/v2/test/src/enumtest enumtest.xsd
daveremy 2004/01/23 17:01:48
Modified: v2/bin dumpxsb scomp validate
v2/src/typeimpl/org/apache/xmlbeans/impl/schema
SchemaTypeCodePrinter.java StscJavaizer.java
StscTranslator.java
v2/src/xmlpublic/org/apache/xmlbeans GDateBuilder.java
v2/test/src/drt/drtcases GDateTests.java
ValidationTests.java
v2/test/src/enumtest enumtest.xsd
Added: v2 xbeanenv.sh
Log:
merging some recent fixes from the v1 tree into the v2 tree.
DRTs: passed
Revision Changes Path
1.1 xml-xmlbeans/v2/xbeanenv.sh
Index: xbeanenv.sh
===================================================================
export XMLBEANS_HOME=`pwd`
1.3 +6 -0 xml-xmlbeans/v2/bin/dumpxsb
Index: dumpxsb
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/bin/dumpxsb,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- dumpxsb 13 Nov 2003 01:03:00 -0000 1.2
+++ dumpxsb 24 Jan 2004 01:01:48 -0000 1.3
@@ -6,4 +6,10 @@
cp=
cp=$cp:$XMLBEANS_HOME/build/ar/xbean.jar
+case "`uname`" in
+ CYGWIN*)
+ cp=`cygpath -w -p $cp`
+ ;;
+esac
+
java -classpath $cp org.apache.xmlbeans.impl.tool.XsbDumper $*
1.4 +7 -1 xml-xmlbeans/v2/bin/scomp
Index: scomp
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/bin/scomp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- scomp 16 Dec 2003 22:00:50 -0000 1.3
+++ scomp 24 Jan 2004 01:01:48 -0000 1.4
@@ -4,6 +4,12 @@
#Builds XBean types from xsd files.
cp=
- cp=$cp:$XMLBEANS_HOME/build/ar/xbean.jar:$XMLBEANS_HOME/build/lib/jsr173_07_api.jar:$XMLBEANS_HOME/build/lib/resolver.jar
+cp=$cp:$XMLBEANS_HOME/build/ar/xbean.jar:$XMLBEANS_HOME/build/lib/jsr173_07_api.jar:$XMLBEANS_HOME/build/lib/resolver.jar
+
+case "`uname`" in
+ CYGWIN*)
+ cp=`cygpath -w -p $cp`
+ ;;
+esac
java -classpath $cp org.apache.xmlbeans.impl.tool.SchemaCompiler $*
1.2 +8 -2 xml-xmlbeans/v2/bin/validate
Index: validate
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/bin/validate,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- validate 26 Sep 2003 21:23:26 -0000 1.1
+++ validate 24 Jan 2004 01:01:48 -0000 1.2
@@ -1,4 +1,4 @@
-#!/#in/sh
+#!/bin/sh
#
# Instance Validator
#
@@ -7,4 +7,10 @@
CP=
CP=$CP:$XMLBEANS_HOME/build/ar/xbean.jar
-java -classp th $CP org.apache.xmlbeans.impl.tool.InstanceValidator $*
+case "`uname`" in
+ CYGWIN*)
+ cp=`cygpath -w -p $cp`
+ ;;
+esac
+
+java -classpath $CP org.apache.xmlbeans.impl.tool.InstanceValidator $*
1.3 +3 -3 xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
Index: SchemaTypeCodePrinter.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SchemaTypeCodePrinter.java 12 Nov 2003 16:45:53 -0000 1.2
+++ SchemaTypeCodePrinter.java 24 Jan 2004 01:01:48 -0000 1.3
@@ -296,7 +296,7 @@
emit("private static final org.apache.xmlbeans.SchemaTypeSystem loadTypeSystem()");
emit("{");
indent();
- emit("try { return (org.apache.xmlbeans.SchemaTypeSystem)Class.forName(\"org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl\", true, " + shortName + ".class.getClassLoader()).getConstructor(new Class[] { Class.class }).newInstance(new Object[] { " + shortName + ".class }); }");
+ emit("try { return (org.apache.xmlbeans.SchemaTypeSystem)Class.forName(\"org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl\", true, " + shortName + ".class.getClassLoader()).getConstructor(new Class[] { Class.class }).newInstance(new java.lang.Object[] { " + shortName + ".class }); }");
emit("catch (ClassNotFoundException e) { throw new RuntimeException(\"Cannot load org.apache.xmlbeans.impl.SchemaTypeSystemImpl: make sure xbean.jar is on the classpath.\", e); }");
emit("catch (Exception e) { throw new RuntimeException(\"Could not instantiate SchemaTypeSystemImpl (\" + e.toString() + \"): is the version of xbean.jar correct?\", e); }");
outdent();
@@ -827,7 +827,7 @@
outdent();
emit(");");
emit("private static final long serialVersionUID = 1L;");
- emit("private Object readResolve() { return forInt(intValue()); } ");
+ emit("private java.lang.Object readResolve() { return forInt(intValue()); } ");
outdent();
emit("}");
}
@@ -1355,7 +1355,7 @@
break;
case SchemaProperty.JAVA_OBJECT:
- emit("Object[] result = new Object[targetList.size()];");
+ emit("java.lang.Object[] result = new java.lang.Object[targetList.size()];");
emit("for (int i = 0, len = targetList.size() ; i < len ; i++)");
emit(" result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getObjectValue();");
break;
1.2 +5 -0 xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/StscJavaizer.java
Index: StscJavaizer.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/StscJavaizer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StscJavaizer.java 26 Sep 2003 21:23:28 -0000 1.1
+++ StscJavaizer.java 24 Jan 2004 01:01:48 -0000 1.2
@@ -164,6 +164,11 @@
{
if (sImpl.isJavaized())
return;
+
+ SchemaTypeImpl baseType = (SchemaTypeImpl)sImpl.getBaseType();
+ if (baseType != null)
+ skipJavaizingType(baseType);
+
sImpl.startJavaizing();
secondPassProcessType(sImpl);
sImpl.finishJavaizing();
1.3 +34 -3 xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/StscTranslator.java
Index: StscTranslator.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/StscTranslator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- StscTranslator.java 13 Nov 2003 01:03:00 -0000 1.2
+++ StscTranslator.java 24 Jan 2004 01:01:48 -0000 1.3
@@ -466,6 +466,8 @@
/**
* Translates a local or global schema element.
*/
+ // check rule 3.3.3
+ // http://www.w3c.org/TR/#section-Constraints-on-XML-Representations-of-Element-Declarations
public static SchemaLocalElementImpl translateElement(
Element xsdElt, String targetNamespace, boolean chameleon,
List anonymousTypes, SchemaType outerType)
@@ -488,7 +490,6 @@
QName ref = xsdElt.getRef();
-
if (ref != null && name != null)
{
// if (name.equals(ref.getLocalPart()) && uriMatch(targetNamespace, ref.getNamespaceURI()))
@@ -514,14 +515,44 @@
{
if (xsdElt.getType() != null || xsdElt.getSimpleType() != null || xsdElt.getComplexType() != null)
{
- state.error("Element reference cannot also specify a type", XmlErrorContext.INVALID_NAME, xsdElt.xgetName());
+ state.error("Element reference cannot also specify a type", XmlErrorContext.INVALID_NAME, xsdElt);
// recovery: let the name go through anyway.
}
if (xsdElt.getForm() != null)
{
- state.error("Element reference cannot also specify form", XmlErrorContext.INVALID_NAME, xsdElt.xgetName());
+ state.error("Element reference cannot also specify form", XmlErrorContext.INVALID_NAME, xsdElt);
// recovery: let the name go through anyway.
+ }
+
+ if (xsdElt.sizeOfKeyArray() > 0 || xsdElt.sizeOfKeyrefArray() > 0 || xsdElt.sizeOfUniqueArray() > 0)
+ {
+ state.error("Element reference cannot also contain key, keyref, or unique", XmlErrorContext.GENERIC_ERROR, xsdElt);
+ // recovery: ignore
+ }
+
+ if (xsdElt.isSetDefault())
+ {
+ state.error("Element with reference to '" + ref.getLocalPart() + "' cannot also specify default", XmlErrorContext.GENERIC_ERROR, xsdElt);
+ // recovery: ignore
+ }
+
+ if (xsdElt.isSetFixed())
+ {
+ state.error("Element with reference to '" + ref.getLocalPart() + "' cannot also specify fixed", XmlErrorContext.GENERIC_ERROR, xsdElt);
+ // recovery: ignore
+ }
+
+ if (xsdElt.isSetBlock())
+ {
+ state.error("Element with reference to '" + ref.getLocalPart() + "' cannot also specify block", XmlErrorContext.GENERIC_ERROR, xsdElt);
+ // recovery: ignore
+ }
+
+ if (xsdElt.isSetNillable())
+ {
+ state.error("Element with reference to '" + ref.getLocalPart() + "' cannot also specify nillable", XmlErrorContext.GENERIC_ERROR, xsdElt);
+ // recovery: ignore
}
assert(xsdElt instanceof LocalElement);
1.3 +2 -2 xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans/GDateBuilder.java
Index: GDateBuilder.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans/GDateBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GDateBuilder.java 4 Nov 2003 16:09:00 -0000 1.2
+++ GDateBuilder.java 24 Jan 2004 01:01:48 -0000 1.3
@@ -688,9 +688,9 @@
{
if (!((tzSign == 0 && tzHour == 0 && tzMinute == 0) ||
((tzSign == -1 || tzSign == 1) &&
- (tzHour == 0 && tzMinute > 0 || tzHour > 0 && tzMinute >= 0) &&
+ (tzHour >= 0 && tzMinute >= 0) &&
(tzHour == 14 && tzMinute == 0 || tzHour < 14 && tzMinute < 60))))
- throw new IllegalArgumentException("time zone must be betwen -14:00 and +14:00");
+ throw new IllegalArgumentException("time zone must be between -14:00 and +14:00");
if (!hasTimeZone() || !hasTime())
throw new IllegalStateException("cannot normalize time zone without both time and timezone");
1.3 +2 -0 xml-xmlbeans/v2/test/src/drt/drtcases/GDateTests.java
Index: GDateTests.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/test/src/drt/drtcases/GDateTests.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GDateTests.java 4 Nov 2003 16:09:00 -0000 1.2
+++ GDateTests.java 24 Jan 2004 01:01:48 -0000 1.3
@@ -486,6 +486,8 @@
public static void testAPI() throws Exception
{
GDateBuilder builder = new GDateBuilder("1970-12-20T04:14:22Z");
+ builder.normalizeToTimeZone(1, 0, 0);
+ Assert.assertEquals("1970-12-20T04:14:22+00:00", builder.toString());
builder.setTimeZone(615);
Assert.assertEquals("1970-12-20T04:14:22+10:15", builder.toString());
builder.setTimeZone(-345);
1.3 +32 -0 xml-xmlbeans/v2/test/src/drt/drtcases/ValidationTests.java
Index: ValidationTests.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/test/src/drt/drtcases/ValidationTests.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ValidationTests.java 2 Dec 2003 22:48:21 -0000 1.2
+++ ValidationTests.java 24 Jan 2004 01:01:48 -0000 1.3
@@ -1673,4 +1673,36 @@
new QName( "http://openuri.org/testNumerals", "doc" ),
valid, invalid );
}
+
+ // Bugzilla bug #26105: validate derived type from base type enumeration
+ public void testValidate12() throws Exception {
+ String schemas[] = {
+ "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'>\n" +
+
+ "<xsd:element name='enumDef' type='enumDefType'/>\n" +
+ "<xsd:complexType name='enumDefType'>\n" +
+ " <xsd:simpleContent>\n" +
+ " <xsd:extension base='enumType'/>\n" +
+ " </xsd:simpleContent>\n" +
+ "</xsd:complexType>\n" +
+
+ "<xsd:simpleType name='enumType'>\n" +
+ " <xsd:restriction base='xsd:token'>\n" +
+ " <xsd:enumeration value='enum1'/>\n" +
+ " </xsd:restriction>\n" +
+ "</xsd:simpleType>\n" +
+ "</xsd:schema>\n",
+ };
+
+ String[] valid = {
+ "<enumDef>enum1</enumDef>",
+ };
+
+ String[] invalid = {
+ "<enumDef>enum2/enumDef>",
+ };
+
+ doTest(schemas, null, valid, invalid);
+ }
+
}
1.2 +9 -1 xml-xmlbeans/v2/test/src/enumtest/enumtest.xsd
Index: enumtest.xsd
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/test/src/enumtest/enumtest.xsd,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- enumtest.xsd 26 Sep 2003 21:23:41 -0000 1.1
+++ enumtest.xsd 24 Jan 2004 01:01:48 -0000 1.2
@@ -37,5 +37,13 @@
</xs:sequence>
</xs:complexType>
</xs:element>
-
+
+ <!-- bug CR128906: gen'd java code must qualify java.lang.* types -->
+ <xs:simpleType name="object">
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="abc"/>
+ <xs:enumeration value="def"/>
+ </xs:restriction>
+ </xs:simpleType>
+
</xs:schema>
---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org