[ http://issues.apache.org/jira/browse/AXIS2-538?page=comments#action_12372757 ]
Ajith Harshana Ranabahu commented on AXIS2-538: ----------------------------------------------- Ahumm.. The XML Schema specification says when omitted minOccurs and maxOccurs should be taken as "1" (not 0) . And a value can be null only if the nillable attribute is set to true in the schema (and it is false when omitted). If you want the right behavior, you should put the necessary attributes in the schema and the ADB codegen will handle it properly! > Nulls for fields in generated classes not handled properly > ---------------------------------------------------------- > > Key: AXIS2-538 > URL: http://issues.apache.org/jira/browse/AXIS2-538 > Project: Apache Axis 2.0 (Axis2) > Type: Bug > Components: databinding > Versions: 0.95 > Reporter: Dmitriy Kiriy > Priority: Blocker > > If I have in XML Schema > <xsd:element name="SomeDate" type="xsd:date" /> > it mean that minOccurs="0" (from XML Schema specification) > but generated code not handling case that field can be setted up as null: > if (localSomeDateTracker){ > elementList.add(new > javax.xml.namespace.QName("http://mycompany.com/schema/data", > > "SomeDate")); > > elementList.add( > > org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localSomeDate)); > } > Should be something: > if (localSomeDateTracker && localSomeDate!= null && notRequired){ > elementList.add(new > javax.xml.namespace.QName("http://mycompany.com/schema/data", > > "SomeDate")); > > elementList.add( > > org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localSomeDate)); > } else { > throw new Exception("Field SomeDate for entity Someentity required but > null"); > } -- 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
