Hi James,
We don't support "wrapper" elements at this time. However you should be
able to achieve what you want by using a custom FieldHandler that
creates an AnyNode or a wrapper class that <SomeTag> can be mapped to.
For example:
/**
* Lightweight wrapper class needed by Castor marshaller
*/
public class SomeTag {
public String getX1();
public void setX1(String x1);
}
Your custom FieldHandler getValue can do the following:
public Object getValue(Object parent) {
X x = (X)parent;
SomeTag sTag = new SomeTag();
sTag.setX1(x.getX1());
return sTag;
}
The wrapper class is only used during unmarshalling and marshalling and
not as part of the actual object model.
--Keith
> "Corbin, James" wrote:
>
> I guess what I need to find out is if its possible to map a class
> attribute to XML without any body.
>
> For example:
>
> Given class X and attribute X1. (Attribute X1 is the only item that is
> mapped into the tag named SomeTag. My problem is I don't know how to
> specify that the SomeTag tag needs to be created (or how to create it)
> before the X1 attribute is bound using the bind-xml directive.
>
> Can X1 be mapped independently of other attributes in the class to its
> own element like,
>
> <RootClassTag>
> <SomeTag X1="somevalue"/> // How is SomeTag created in the mapping
> file???
> </RootClassTag>
>
> ???
>
> This electronic message transmission contains information from the Company that may
>be proprietary, confidential and/or privileged.
> The information is intended only for the use of the individual(s) or entity named
>above. If you are not the intended recipient, be
> aware that any disclosure, copying or distribution or use of the contents of this
>information is prohibited. If you have received
> this electronic transmission in error, please notify the sender immediately by
>replying to the address listed in the "From:" field.
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev