This message was originally submitted by malowidz_at_WIL.WAW.PL to the
JAXB-INTEREST list at JAVA.SUN.COM. If you simply forward it back to the list,
using a mail command that generates "Resent-" fields (ask your local user
support or consult the documentation of your mail program if in doubt), it will
be distributed and the explanations you are now reading will be removed
automatically. If on the other hand you edit the contributions you receive into
a digest, you will have to remove this paragraph manually. Finally, you should
be able to contact the author of this message by using the normal "reply"
function of your mail program.
----------------- Message requiring your approval (37 lines) ------------------
Hi all,
I have a question regarding using custom Java interfaces in the recent JAXB
implementation. I believe that this answer could have been already answered, but
I failed twice to register to be able to search the archives (did anyone
success?).
In the early access release, there was a nice feature that allowed to declare
custom interfaces to be implemented by generated content Java interfaces. For
example, it could be done using:
<interface name="BasicColumnTemplate" members="ColumnTemplate
ColumnImportTemplate" properties="name label prompt description reference
[...]"/>
This feature disappeared and there does not seem to be any replacement (or am I
missing something?). The problem is that when I have two elements with a similar
subsert of sub-elements and attributes, often I would like to be able to group
the common features in an interface. For elements, it could be (partially,
because of the order in which the elements appear) solved by using groups with
modelGroupAsClass="true" (however, the current RI does not support this
feature). But for attributes I cannot see a possible (elegant) solution - groups
can't contain attributes.
The solution I am using is to include in the schema some artificial types
grouping these common features. Then, after the content classes have been
generated, I manually extend the generated interfaces with the "artificial"
ones. Quite ugly and error-prone, but is there a better solution.
The second question: It is not possible anymore to find out if attribute's value
has been provided in an instance document (the hasXXX() methods from the early
release version). Is this true?
Best regards and thanks for the help.
Marek