users@jaxb.java.net

Re: JAXB/XJC generated annotations and xs:documentation

From: Lucas Madar <lucas_at_mcsnw.com>
Date: Tue, 12 May 2009 10:49:51 -0700

>
> Essentially, annotate plugin would do what you want, the only problem
> is that you want to parse xs:documentation elements instead of custom
> appinfo. So the only thing you have to figure out is how to get
> original DOM elements for documentation from XSComponent.
> After some checking of code I'd say this is not possible at the
> moment. XJC uses its own annotation parser to parse annotations into
> BindInfos, documentation is presented by the
> com.sun.tools.xjc.reader.xmlschema.bindinfo.BindInfo.Documentation
> class.
>
> First problem is that this class only stores mixed content of the
> original annotation element, no attributes (say goodbye to xml:lang).
> Second problem is that BindInfo converts these contents to string,
> there is no way to retrieve the original content (which can be text
> and DOM elements).
>
Yeah. It also appears that xjc completely disregards comments that would
be intended solely for class fields, providing no way to access them.

Would it be possible to write an xjc extension that modifies the DOM
tree of the incoming schema? That way I could duplicate the docs into
xs:appinfo tags and parse them with the annotate plugin. The problem is
that I don't have control over the schema, it's published by another
entity; getting them to add custom appinfo tags for my application
wouldn't be possible. If that's not possible, is it possible to override
xjc's schema location resolver?

Thanks,
Lucas