I had the same issue.  If you change your XSD file to have an fooArray complexType like below, then it works.
<complexType name="Document">
<element name="attachments" type="tns:ArrayOfFileName"/>
..
</complexType>

<complexType name="ArrayOfFileName">
<sequence>
<element name="item" type="string" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>

However, in this case castor generate an extra level of indirection in the Java code that I don't want.  (See the unwanted Attachments class below.)

class Document {
private Attachments _attachments;
}

class Attachments extends ArrayOfAttachment ...

class ArrayOfAttachment implements java.io.Serializable {
private java.util.Vector _itemList;
}

I was hoping there was a better solution.


Alan Talanoa wrote:
Currently, Ive only managed to create xml docs like this: 

<order> 
<cost>12.23</cost> 
<item> 
foo 
</item> 
<item> 
bar 
</item> 
</order> 

I need to be able generate: 

<order> 
<cost>12.23</cost> 
<ITEMS> 
<item> 
foo 
</item> 
<item> 
bar 
</item> 
</ITEMS> 
</order> 

Reading through documentation, map-to only works for the root element, but I need to be able to define a "wrapping" element for when I am using a collection to generate XML. I've read a bit about "containers" but dont think thats what I need?

  

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

Reply via email to