Hi,
I'd have to try this myself first to give you a precise answer, but you
could have a look at the 'required' attribute.
Regards
Werner
On 07.02.2012 18:23, Alessandro wrote:
Hello everybody,
I started using Castor a few weeks ago, quite happily until now. But I
came across an issue I haven't found a solution for.
I want to generate an XML with empty tags where no value is present in
my java object. Be that an empty collection or a null field. With the
default configuration though I don't get any element at all.
How can I instruct castor to do this?
Here is a fragment of my castor-mapping.xml
<class
name="org.youthnet.doit.syndication.common.model.response.SyndicationOpportunity">
<map-to xml="opportunity"
ns-uri="http://www.do-it.org.uk/volunteering-opportunity"/>
<field name="title" type="java.lang.String"/>
<field name="summary" type="java.lang.String"/>
<field name="availability"
type="org.youthnet.doit.syndication.common.model.response.SyndicationAvailability">
<bind-xml name="times"/>
</field>
<field name="activities" collection="arraylist"
type="org.youthnet.doit.domain.Activity">
<bind-xml location="activities" name="activity"/>
</field>
..... for instance I want an<activities> tag even if the activities
collection is empty.
Any clue about how to do this?
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email