You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by ra...@apache.org on 2005/10/13 03:23:30 UTC

svn commit: r320602 - in /xmlbeans/trunk: bin/svalidate src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java src/typeimpl/org/apache/xmlbeans/impl/schema/StscJavaizer.java src/xmlcomp/org/apache/xmlbeans/impl/tool/InstanceValidator.java

Author: radup
Date: Wed Oct 12 18:23:22 2005
New Revision: 320602

URL: http://svn.apache.org/viewcvs?rev=320602&view=rev
Log:
Fixed Java code generation in case of union type redefinition. Changed validate to use line numbers for end tags and fixed svalidate on Linux.

Modified:
    xmlbeans/trunk/bin/svalidate
    xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
    xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscJavaizer.java
    xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/InstanceValidator.java

Modified: xmlbeans/trunk/bin/svalidate
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/bin/svalidate?rev=320602&r1=320601&r2=320602&view=diff
==============================================================================
--- xmlbeans/trunk/bin/svalidate (original)
+++ xmlbeans/trunk/bin/svalidate Wed Oct 12 18:23:22 2005
@@ -21,7 +21,7 @@
 
 if [ -z $XMLBEANS_LIB ]; then . `dirname $0`/_setlib; fi
 
-cp=$XMLBEANS_LIB/xbean.jar:$XMLBEANS_LIB/jsr173_1.0_api.jar:$XMLBEANS_LIB/jsr173_1.0_ri.jar
+CP=$XMLBEANS_LIB/xbean.jar:$XMLBEANS_LIB/jsr173_1.0_api.jar:$XMLBEANS_LIB/jsr173_1.0_ri.jar
 
 case "`uname`" in
     CYGWIN*)

Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java?rev=320602&r1=320601&r2=320602&view=diff
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java (original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeCodePrinter.java Wed Oct 12 18:23:22 2005
@@ -563,10 +563,10 @@
                 else
                     printInnerType(anonTypes[i], system);
             }
-            // For redefinition by extension, go ahead and print the anonymous
-            // types in the base
+            // For redefinition other than by extension for complex types, go ahead and print
+            // the anonymous types in the base
             if (!redefinition ||
-                sType.getDerivationType() != SchemaType.DT_EXTENSION)
+                (sType.getDerivationType() != SchemaType.DT_EXTENSION && !sType.isSimpleType()))
                 break;
             sType = sType.getBaseType();
         }
@@ -2606,7 +2606,7 @@
             // For redefinition by extension, go ahead and print the anonymous
             // types in the base
             if (!redefinition ||
-                sType.getDerivationType() != SchemaType.DT_EXTENSION)
+                (sType.getDerivationType() != SchemaType.DT_EXTENSION && !sType.isSimpleType()))
                 break;
             sType = sType.getBaseType();
         }

Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscJavaizer.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscJavaizer.java?rev=320602&r1=320601&r2=320602&view=diff
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscJavaizer.java (original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscJavaizer.java Wed Oct 12 18:23:22 2005
@@ -68,9 +68,11 @@
             else
                 skipJavaizingType((SchemaTypeImpl)gType);
             allSeenTypes.addAll(Arrays.asList(gType.getAnonymousTypes()));
-            if (((SchemaTypeImpl) gType).isRedefinition() &&
-                gType.getDerivationType() == SchemaType.DT_EXTENSION)
-                addAnonymousTypesFromRedefinition(gType.getBaseType(), allSeenTypes);
+            // We need to javaize the anonymous types defined inside redefined types
+            // since redefined type do not get a Java class of their own.
+            // The exception is complex types derived by restriction, since in this case
+            // anonymous types are not inherited
+            addAnonymousTypesFromRedefinition(gType, allSeenTypes);
         }
     }
 
@@ -315,13 +317,12 @@
         StscState state = StscState.get();
 
         int nrOfAnonTypes = anonymousTypes.length;
-        if (outerType.isRedefinition() &&
-            outerType.getDerivationType() == SchemaType.DT_EXTENSION)
+        if (outerType.isRedefinition())
         {
             // We have to add the anonymous types for redefinitions to the list
             // since they don't have another outer class
             ArrayList list = new ArrayList();
-            addAnonymousTypesFromRedefinition(outerType.getBaseType(), list);
+            addAnonymousTypesFromRedefinition(outerType, list);
             if (list.size() > 0)
             {
                 SchemaType[] temp = new SchemaType[nrOfAnonTypes + list.size()];
@@ -868,14 +869,14 @@
 
     static void addAnonymousTypesFromRedefinition(SchemaType sType, List result)
     {
-        while (sType != null)
+        while (((SchemaTypeImpl)sType).isRedefinition() &&
+                (sType.getDerivationType() == SchemaType.DT_EXTENSION ||
+                        sType.isSimpleType()))
         {
+            sType = sType.getBaseType();
             SchemaType[] newAnonTypes = sType.getAnonymousTypes();
             if (newAnonTypes.length > 0)
                 result.addAll(Arrays.asList(newAnonTypes));
-            if (sType.getDerivationType() != SchemaType.DT_EXTENSION)
-                break;
-            sType = sType.getBaseType();
         }
     }
 }

Modified: xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/InstanceValidator.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/InstanceValidator.java?rev=320602&r1=320601&r2=320602&view=diff
==============================================================================
--- xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/InstanceValidator.java (original)
+++ xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/InstanceValidator.java Wed Oct 12 18:23:22 2005
@@ -175,7 +175,7 @@
             try
             {
                 xobj =
-                    sLoader.parse( instanceFiles[i], null, (new XmlOptions()).setLoadLineNumbers() );
+                    sLoader.parse( instanceFiles[i], null, (new XmlOptions()).setLoadLineNumbers(XmlOptions.LOAD_LINE_NUMBERS_END_ELEMENT) );
             }
             catch (Exception e)
             {



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