Kurt, because I have a class I don't intend to change for this specific scenario.
There are several ways to solve this programmatically, but this is exactly my point here. I expect Castor to do the whole binding job w/o adding extra code to my app. It's a simple bind one-to-many from xml to class property, I can't see why Castor wouldn't support that. If it makes no sense for Castor to do it (that is I guess YOUR point), it should at least throw me an error stating my mapping file is doing nonsense stuff. Thanks, Diego De: KURT PETERS [mailto:[email protected]] Enviada em: sexta-feira, 6 de agosto de 2010 11:33 Para: [email protected] Assunto: RE: RES: [castor-user] Castor - Trouble trying to bind same XML tag to multiple class fields WHy wouldn't you just make the assignment to senderID in the setter for supplierID? Kurt ________________________________ From: [email protected] To: [email protected] Date: Fri, 6 Aug 2010 11:10:55 -0300 Subject: RES: [castor-user] Castor - Trouble trying to bind same XML tag to multiple class fields Kurt, why not? I couldn't find such a restriction in the docs. Thanks, Diego De: KURT PETERS [mailto:[email protected]] Enviada em: quinta-feira, 5 de agosto de 2010 23:05 Para: [email protected] Assunto: RE: [castor-user] Castor - Trouble trying to bind same XML tag to multiple class fields Aren't they referring to the same xml element? Something like: <invoice> <header> <sup> <ID> string-you-desire </ID> </sup> </header> </invoice> Why would you think that it would be applied twice? It seems that it would do exactly what you say it actually does. Kurt ________________________________ From: [email protected] To: [email protected] Date: Thu, 5 Aug 2010 19:52:17 -0300 Subject: [castor-user] Castor - Trouble trying to bind same XML tag to multiple class fields Hi, Is Castor capable of binding the very same tag from an XML to multiple class fields through distinct mapping file entries? Please give a look at the mapping below: <field name="supplierID" type="java.lang.String"> <bind-xml name="ID" node="element" location="invoice/header/sup" /> </field> <field name="senderID" type="java.lang.String"> <bind-xml name="ID" node="element" location="invoice/header/sup" /> </field> The above mapping will populate "supplierID" only leaving "senderID" null. The expected behavior would be my object to end up with both fields filled in with the same information (that is for instance defined by "invoice/header/sup/ID"). Any clues? Any help is appreciated. Thanks, Diego

