Keith,

Keith Visco wrote:
This isn't something easily done in Castor. I've done this myself in the past using a dynamic FieldDescriptor approach, basically you need to override the XMLClassDescriptor#getFieldDescriptor method such that it creates an XMLFieldDescriptor using the passed in xml name, or returns a cached one based on the given name.

I'm not that deep into the Castor API, so I'll definitely need some examples. However, I considered alternatives such as building a DOM tree using JDOM, as the aforementioned Attribute class participates in the GoF's Composite and Visitor patterns as the abstract element.


Thus, it shouldn't be too hard to write an XMLModelAttributeVisitor which walks down the Attribute tree and creates an org.w3c.dom.Document. The question is, however, whether hacking Castor would be *less effort*. What do you think?

I don't have time to provide more details at the moment, but if you're feeling brave you may want to start looking into that approach. If you're having trouble with this, I'll see if I can dig up the code I wrote a while back and provide a more concrete example for you when I get some free time.

Please take your time -- I'm not in such a hurry (although I need it for my thesis...).


Regards,
Alexander

Reply via email to