Wrong code generation when xs:extension used in schema
------------------------------------------------------

                 Key: AXIS2-1928
                 URL: http://issues.apache.org/jira/browse/AXIS2-1928
             Project: Apache Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: adb
         Environment: Windows XP, JDK 1.4
            Reporter: Ram Lakshmanan


Axis2 with ADB Binding generates wrong code when complexType elements are built 
with xs:extension. Here goes excerpt from our schema:

<xs:complexType name="Reference_Type">
        <xs:complexContent>
                <xs:extension base="acct-d1:Reference_Type">
                        <xs:sequence>
                                <xs:element ref="svc-acct:keyGrpHogan" 
minOccurs="0"/>
                        </xs:sequence>
                </xs:extension>
        </xs:complexContent>
</xs:complexType>

Generated code doesn't parses the elements present in "acct-d1:Reference_Type". 
It totally ignores them. In the generated code you can easy that it's parsing 
only the: "svc-acct:keyGrpHogan" and not the elements in 
"acct-d1:Reference_Type". Here goes the generated code's parse() API:


        public static Reference_Type349 parse(javax.xml.stream.XMLStreamReader 
reader) throws java.lang.Exception{
            Reference_Type349 object = new Reference_Type349();
            int event;
            try {
                
                while (!reader.isStartElement() && !reader.isEndElement())
                    reader.next();

                
                if 
(reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type";)!=null){
                  java.lang.String fullTypeName = 
reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance";,
                        "type");
                  if (fullTypeName!=null){
                    java.lang.String nsPrefix = 
fullTypeName.substring(0,fullTypeName.indexOf(":"));
                    nsPrefix = nsPrefix==null?"":nsPrefix;

                    java.lang.String type = 
fullTypeName.substring(fullTypeName.indexOf(":")+1);
                    if (!"Reference_Type".equals(type)){
                        //find namespace for the prefix
                        java.lang.String nsUri = 
reader.getNamespaceContext().getNamespaceURI(nsPrefix);
                        return 
(Reference_Type349)com.wellsfargo.eai_schemas.provider.aps.accountinquiry.ExtensionMapper.getTypeObject(
                             nsUri,type,reader);
                      }

                  }

                }
                

                
                // Note all attributes that were handled. Used to differ normal 
attributes
                // from anyAttributes.
                java.util.Vector handledAttributes = new java.util.Vector();
                

                boolean isReaderMTOMAware = false;
                
                try{
                  isReaderMTOMAware = 
java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE));
                }catch(java.lang.IllegalArgumentException e){
                  isReaderMTOMAware = false;
                }


                
                    
                    reader.next();
                
                                    
                                    while (!reader.isStartElement() && 
!reader.isEndElement()) reader.next();
                                
                                    if (reader.isStartElement() && new 
javax.xml.namespace.QName("http://service.wellsfargo.com/entity/account/2003/","keyGrpHogan";).equals(reader.getName())){
                                
                                        
object.setKeyGrpHogan(com.wellsfargo.service.entity.account._2003.KeyGrpHogan_Type.Factory.parse(reader));
                                      
                                        reader.next();
                                    
                              }  // End of if for expected property start 
element
                              
                            while (!reader.isStartElement() && 
!reader.isEndElement())
                                reader.next();
                            if (reader.isStartElement())
                                // A start element we are not expecting 
indicates a trailing invalid property
                                throw new 
java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName());
                        


            } catch (javax.xml.stream.XMLStreamException e) {
                throw new java.lang.Exception(e);
            }

            return object;
        }

        }//end of factory class

Do let me know, if you need any further information.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to