Thank you for your reply.
I'm currently interested in "triggering" some customized code generation
when an element is annotated. Consider, for example, the following
annotation:
<xsd:element name="configFile" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<myns:file>
<myns:validateExistence />
</myns:file>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
The 'configFile' element should be a java.util.File element, which is
validated for existence when parsed. Again, I know this can be achieved
using the jaxb:javaType annotation, but this is just an example.
Kind Regards,
Rune Bjørnstad.
-----Original Message-----
From: Kohsuke Kawaguchi [mailto:Kohsuke.Kawaguchi_at_Sun.COM]
Sent: 18. januar 2005 18:55
To: users_at_jaxb.dev.java.net
Subject: Re: Customization namespaces and "vendor extensions"
Rune Peter Bjørnstad wrote:
> By accessing a generated classes JavaDoc, and parsing it using my “vendor
> extension?, I’m able to generate classes that adapts to my needs. This is
> all fine and dandy, but I’m currently investigating how this can be done
> more elegantly. The following XML Schema annotation is the notation I
would
> like to be able to use:
I see. That makes sense.
> Does to the JAXB RI provide “hooks? for providing vendor customization
> namespaces, which can be use din order to customize class creation? The
> example above is just used to demonstrate what I would like to do. I am
> aware that the result can be achieved using current RI customization
> features, but this is not the object of my question.
Today, it doesn't. But this is something I'm interested in integrating
into 2.0.
Allowing an extension to participate in the parsing of annotation is
relatively easy. We can accept your ContentHandler and namespace URI of
your extension, and then I can feed annotations to you.
The hard part to me is to associate your parsed annotations back to the
model we build. XML Schema defines a lot more annotation points than
JAXB can meaningfully differentiate.
For example, knowing nothing about the semantics of your extension, what
shall the RI do if it sees your annotation on, say, <xs:include>? Or
say, if your annotation is on <xs:complexType>. The RI can be hard-coded
to pass such an annotation onto a ClassContext/ClassItem.
It would help me a lot if you can tell me more about where do you plan
to allow your annotations and in which model object you'd like to see them.
--
Kohsuke Kawaguchi
Sun Microsystems kohsuke.kawaguchi_at_sun.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net