I am playing with auto-naming now -- thank you! -- although at first glance it appears to be useful for unmarshalling interfaces, and not for the problem I'm trying to solve (unmarshalling the contents of a map).
Jessica On Tue, Dec 20, 2005 at 04:18:42PM +0100, Werner Guttmann wrote: > Jessica, > > At the bottom of section 5 > (http://castor.codehaus.org/xml-mapping.html#5.-xsi:type) you are going > to find a statement similar to > > Suppose we wanted the following XML instead: > > <engine> > <myProcessor/> > </engine> > > Instead of using the xsi:type attribute. If you read on, you are going > so see that you can instruct Castor XML to use the class name instead, > as specified in the following field mapping. > > <field name="processor" type="IProcessor" required="true"> > <bind-xml auto-naming="deriveByClass" node="element" /> > </field> > > I hope this answers your question in parts. > > Werner > > > wg> -----Original Message----- > wg> From: Jessica Perry Hekman [mailto:[EMAIL PROTECTED] > wg> Sent: Tuesday, December 20, 2005 4:02 PM > wg> To: [email protected] > wg> Subject: Re: [castor-user] Objects in Maps > wg> > wg> ...actually, as I struggle to get my little test case to > wg> break with that NullPointerException at > wg> org.exolab.castor.xml.MarshalFramework.searchInheritance > wg> (or alternately and even better to get the real code to NOT > wg> break), I realize: this whole project is intended to get > wg> the system to listen to commands via REST. As one coworker > wg> said when I asked him why we had setSuppressXSIType to true > wg> in the first place, "otherwise it puts in all kinds of > wg> stuff that we didn't think REST wanted to see." > wg> > wg> In other words, people are going to want to send XML over > wg> the wire to create a new one of these objects, and > wg> apparently we don't want to have to ask them to specify > wg> XSI:type. I can push back on this if necessary, but: > wg> > wg> Is there in fact another way to go about taking the XML for > wg> a map and turning it into a Map with the correct objects inside it? > wg> > wg> I fantasize about something like > wg> > wg> <map> > wg> <key>some string here</key> > wg> <value> > wg> <cost>...</cost> > wg> </value> > wg> </map> > wg> > wg> ...such that it knows to map "cost" into a Cost object. (I > wg> guess the question of how to map the key into a String remains.) > wg> > wg> Am I headed in completely the wrong direction? > wg> > wg> Jessica > wg> > wg> ------------------------------------------------- > wg> If you wish to unsubscribe from this list, please send an > wg> empty message to the following address: > wg> > wg> [EMAIL PROTECTED] > wg> ------------------------------------------------- > wg> > wg> ------------------------------------------------- If you wish to unsubscribe from this list, please send an empty message to the following address: [EMAIL PROTECTED] -------------------------------------------------

