I have been trying unsuccessfully to unmarshal a specific subclass of an
abstract base class based
on an xml attribute and not the name of the xml element(which will
always be command).
I found a post from a year ago that describes exactly what I am trying
to do and wanted to make sure that I still have to implement a new
FieldHandler to accomplish the task below. Has this changed with newer
releases of Castor? Sorry if this is explained in the documentation, I
couldn't find it.
Dan
--------------------------------------------------------------------------------------
From: Keith Visco
Subject: Re: [castor-dev] Un/Marshalling abstract objects
Date: Thu, 18 Oct 2001 16:03:47 -0700
"TERRILL,JODY (HP-Boise,ex1)" wrote:
>
> Next questions... :)
>
> Is there any way (short of using XSL translation) to unmarshal an object
> based upon an Attribute?
> Example:
> <Command Type="Submit"/>
> would create a submit object while
> <Command Type="Query"/>
> would create a query object.
Not really...there is a trick....but it's a bit of work.
You need to use the "xsd:string" type for your attribute defintion.
Then you can modify the generated descriptor so that it can create the
Object from your the string value.
An example of this is DateFieldHandler, which takes a String and creates
a Date.
The Marshalling framework thinks it is simply dealing with a String, but
your object model actually uses something more complex.
The good thing, is that it can be done.
The bad thing is that you need to write the proper code. If you do this,
becareful
not to overwrite your code if you ever need to regenerate the object
model.
--Keith
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
- [castor-dev] Un/Marshalling abstract objects TERRILL,JODY (HP-Boise,ex1)
- Re: [castor-dev] Un/Marshalling abstract ... Tom Drake
- Re: [castor-dev] Un/Marshalling abstract ... TERRILL,JODY (HP-Boise,ex1)
- Re: [castor-dev] Un/Marshalling abstr... Tom Drake
- [castor-dev] Unsubscribe Sumesh Bhagat
- [castor-dev] circular referen... Keith Chew
- Re: [castor-dev] Un/Marshalling abstr... Keith Visco
- Daniel Sommer
