xml-xmlbeans-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From david...@apache.org
Subject cvs commit: xml-xmlbeans/v1/src/typeimpl/org/apache/xmlbeans/impl/values XmlComplexContentImpl.java
Date Wed, 24 Sep 2003 19:01:29 GMT
davidbau    2003/09/24 12:01:29

  Modified:    v1/src/typeimpl/org/apache/xmlbeans/impl/values
                        XmlComplexContentImpl.java
  Log:
  This fixes a code generation bug (i.e., code was being generated that wasn't linking)
  when dealing with a specific cosmic coincidence of different features:
  
  (1) When there is a complex type...
  (2) That has an element with maxOccurs > 1
  (3) Where the element is a substitution group head
  (4) And the element has type xs:anyType
  
  Then: we generated code that assumed that XmlComplexContentImpl had a helper method
  that it actually doesn't have.  This checkin adds that helper method.
  
  Code review: eric (thanks!)
  Regression tests: passed
  Diffs...
  
  ? v1/build
  Index: v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlComplexContentImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlComplexContentImpl.java,v
  retrieving revision 1.1
  diff -u -r1.1 XmlComplexContentImpl.java
  --- v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlComplexContentImpl.java	15 Sep 2003
18:20:30 -0000	1.1
  +++ v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlComplexContentImpl.java	24 Sep 2003
18:58:39 -0000
  @@ -1095,4 +1095,29 @@
       {
           get_store().array_setter( sources, elemName );
       }
  +
  +    protected void arraySetterHelper ( XmlObject[] sources, QName elemName, QNameSet set
)
  +    {
  +        int n = sources == null ? 0 : sources.length;
  +
  +        TypeStore store = get_store();
  +
  +        int m = store.count_elements( set );
  +
  +        for ( ; m > n ; m-- )
  +            store.remove_element( set, m - 1 );
  +
  +        for ( int i = 0 ; i < n ; i++ )
  +        {
  +            TypeStoreUser user;
  +
  +            if (i >= m)
  +                user = store.add_element_user( elemName );
  +            else
  +                user = store.find_element_user( set, i );
  +
  +            ((XmlObjectBase) user).set( sources[ i ] );
  +        }
  +    }
  +
   }
  
  Revision  Changes    Path
  1.2       +25 -0     xml-xmlbeans/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlComplexContentImpl.java
  
  Index: XmlComplexContentImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v1/src/typeimpl/org/apache/xmlbeans/impl/values/XmlComplexContentImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XmlComplexContentImpl.java	15 Sep 2003 18:20:30 -0000	1.1
  +++ XmlComplexContentImpl.java	24 Sep 2003 19:01:29 -0000	1.2
  @@ -1095,4 +1095,29 @@
       {
           get_store().array_setter( sources, elemName );
       }
  +
  +    protected void arraySetterHelper ( XmlObject[] sources, QName elemName, QNameSet set
)
  +    {
  +        int n = sources == null ? 0 : sources.length;
  +        
  +        TypeStore store = get_store();
  +
  +        int m = store.count_elements( set );
  +
  +        for ( ; m > n ; m-- )
  +            store.remove_element( set, m - 1 );
  +
  +        for ( int i = 0 ; i < n ; i++ )
  +        {
  +            TypeStoreUser user;
  +            
  +            if (i >= m)
  +                user = store.add_element_user( elemName );
  +            else
  +                user = store.find_element_user( set, i );
  +
  +            ((XmlObjectBase) user).set( sources[ i ] );
  +        }
  +    }
  +
   }
  
  
  

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


Mime
View raw message