of course.

Andrea

Keith Visco wrote:


Hi Andrea,

Can you open up a bug report on this and we'll take a look into it.

Thanks,

--Keith

Andrea A. A. Gariboldi wrote:

Hi all,
   i had a problem using the binding file for the Source Generator:

I had this complex type:

<xsd:complexType name="preventivoType">
<xsd:sequence>
<xsd:element name="dettagli" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="dettaglio" type="ivp:dettaglioType" maxOccurs="unbounded" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:integer"/>
<xsd:attribute name="totale" type="xsd:double"/>
</xsd:complexType>


with this binding file directive:

<cbf:complexTypeBinding name="preventivoType">
<cbf:java-class package="it.init.comonline.model.ivp.dto" final="true" equals="true"/>
<cbf:elementBinding name="dettagli">
<cbf:java-class package="it.init.comonline.model.ivp.dto" final="true" equals="true"/>
<cbf:elementBinding name="dettaglio">
* <cbf:member name="pluto" collection="odmg"/>
* </cbf:elementBinding>
</cbf:elementBinding>
</cbf:complexTypeBinding>


I had used the odmg collection for example.

Following this binding file the source generator makes a javaclass with an attribute renamed to the
name i give like this:


*    private java.util.ArrayList _plutoList;
*
but as you can see, it ignores the collection="odmg" attribute.


Digging into the code, and developing a custom FieldInfoFactory i've seen that the metod :


public CollectionInfo createCollection
(XSType contentType, String name, String elementName, String collectionName)


is never called directly with the collection defined in the binding file.

Looking at castor sources i've found the following into the MemberFactory.java (castor-0.9.6 - line 313).

int maxOccurs = component.getUpperBound();
int minOccurs = component.getLowerBound();
* if (simpleTypeCollection || ((maxOccurs < 0) || (maxOccurs > 1))) {
* String vName = memberName+"List";
//--if xmlName is null it means that
//--we are processing a container object (group)
//--so we need to adjust the name of the members of the collection
CollectionInfo cInfo;
cInfo = _infoFactory.createCollection(xsType, vName, component.getJavaMemberName());
XSList xsList = cInfo.getXSList();
if (!simpleTypeCollection) {
xsList.setMaximumSize(maxOccurs);
xsList.setMinimumSize(minOccurs);
}
fieldInfo = cInfo;
} else {
switch (xsType.getType()) {
case XSType.ID_TYPE:
fieldInfo = _infoFactory.createIdentity(memberName);
break;
case XSType.COLLECTION:
String collectionName = component.getCollectionType();
* fieldInfo = _infoFactory.createCollection( ((XSList) xsType).getContentType(),
memberName,
xmlName, collectionName);
* break;
default:
fieldInfo = _infoFactory.createFieldInfo(xsType, memberName);
break;
}
}



so the only way the metod can be called is that (maxOccurs == 0|| maxOccurs == 1 || !simpleTypeCollection)
_but how can be possible if this is a collection?? (maxOccurs should be > 1)_


I'm missing something?

Could you please tell me if there is way to get around this?

Is this a bug?

thanks to all,
Andrea








------------------------------------------------------------------------

----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev




----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev



----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev

Reply via email to