Hi Werner, answers below:
*João Antunes*MsC in Communication Networks Engineering <https://fenix.ist.utl.pt/cursos/merc?locale=en_EN> at IST <http://www.ist.utl.pt/en/about-IST/>
Web: http://web.ist.utl.pt/~joao.a.p.antunes <http://web.ist.utl.pt/%7Ejoao.a.p.antunes>
E-mail: [email protected] <mailto:[email protected]> LinkedIn: http://pt.linkedin.com/in/joaoapantunes*Instituto Superior Técnico - Centro de Informática/Direcção de Serviços de Informação*
Software Engineer - FénixEDU team *Proud associate of **G3SI* <http://g3si.netai.net/index.php?lang=en> Em 09/05/11 14:31, Werner Guttmann escreveu:
Because I'm not sure that JAXB annotations are what I need. Actually I just checked them and I think it wouldn't solve the problem I have. Also, quite bluntly speaking, I have a full stack of projects to work on, unfortunately even my O.S. library is being neglected ATM, so, sorry, no time for that.Hi Joao, On 09.05.2011 09:05, João Antunes wrote:Hello! First of all, thanks for the contribute given to the O.S. community that the castor lib represents; also, please accept my apologies if an answer for this question already exists, meaning that I didn't search thoroughly enough for it. I was wondering if I can use Castor to map Annotations in fields/methods in Java to translate into XML location elements or XML attributes,No, it does not have support for XML annotations. There used to be active development on providing support for JAXB annotations, but that died off ... and to my knowledge is not finished.e.g.: -- Java file: [...] Class YPTO { @XPTOAnnotation{ yada } private String stringToPersist; public String getStringToPersist() { [...] into XML File: <YPTO> <stringToPersist XPTOAnnotation=yada>contentofthestring</stringToPersist> [...] or alternatively: <YPTO> <XPTOAnnotation yada> <stringToPersist>contentofthestring</stringToPersist> [or] <YPTO> <XPTOAnnotation> <yada> <!-- Or even without the YADA, I really don't need the details of the annotations --> <stringToPersist>contentofthestring</stringToPersist> [...] -- As I could understand, the field element in the XML Mapping does not support the annotations. Is there any plugin/element that I missed to implement this?No, you have not missed anything.My end goal is to generate XHTML using XML which came from a JavaBean, the idea is to make a generic XSLT (or DVSL, whichever is easier [ I guess DSVL<http://velocity.apache.org/dvsl/devel/> will be easier, also if anyone has any comment about this, feel free to give a hint :)]) that will pickup on the hints provided on the bean on the form of annotations (I will use annotations because I guess that is the way to go here, but I can go with something else if it's easier to implement ) to render the XHTML using a predetermined 'XHTML template'. In case a plugin doesn't exist, any info on how I should do this? writing a plugin/patch to the lib to implement this behaviour might be what I end up doing, ...Hmm, why not invest the time in trying to finish the support for the JAXB annotations ? I guess that's not the answer you've been looking for (at least not precisely), but let's see what you think of my answers.
It seems that the way for me to go is to use Castor marshaller and then get all of the annotations of the class and iterate through the XML DOM to add the XML attributes. I'll post the solution as soon as I have implemented it for whomever who might be interested in doing something similar and runs into this thread.
Cheers, João
Cheers Werneras long as it's less time consuming than the alternative which is to define a XSD and use JAXB and a generic algorithm to interpret beans [which castor already does] and its annotations [which is what it would be perfect if castor already did had :)]. Thanks in advance, João Antunes--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
<<attachment: joao_antunes.vcf>>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email

