users@jaxb.java.net

Response to: Customizing IDREF target type?

From: Jeremy Clarke <jeremy.clarke_at_alphatech.com>
Date: Tue, 16 Mar 2004 14:51:25 -0500

This is in regard to the message at the bottom which was posted on
2003-08-04.

I have run into the same issue. I have attribute types set to xsd:ID and
xsd:IDREF. I'd like to force the get/set methods to return stronger types
than java.lang.Object. In particular I need to return types described
elsewhere in the same schema.

Section 5.8.2 in the JAXB specification dated January 8th, 2003 describes
that this typing "could" be possible. See below.
>>>

Given XML Schema fragment:
<xs:complexType name="Book">
         <xs:sequence>
                 <xs:element name="author" type="xs:IDREF"/>
                 <!-- ... -->
         </xs:sequence>
</xs:complexType>
<xs:complexType name="AuthorBio">
         <xs:sequence><!-- ... --> </xs:sequence>
         <xs:attribute name="name" type="xs:ID"/>
</xs:complexType>

"Note that ID and IDREF mechanisms does not incorporate the type definitions
that can be referenced. A binding declaration customization could specify that
the base type for the author property of content interface Book should be
AuthorBio instead of java.lang.Object to make for a more meaningful binding."
<<<

At the time of the last posting it sounded like there was no supported way
to map a type to an IDREF. Is this still the case? Are there any
solutions, supported or otherwise, that may address this problem?

Thanks,
Jeremy Clarke
jeremy.clarke_at_alphatech.com


----------------------------------------------------------------------------------------------------------------------------------------------------
Response to:
<https://jaxb.dev.java.net/servlets/ReadMsg?list=users&msgNo=1805>Customizing
IDREF target type? (Dennis Sosnoski)

Date: Mon, 16 Jun 2003 07:49:28 -0700
From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Subject: Customizing IDREF target type?
Content-type: text/plain; charset=US-ASCII


Since your schema can be combined with other schemas at run-time, we are
not allowed to map that IDREF to Carrier by default.

But I think there's an unsupported customization that lets you do this,
if you are willing to go there.

I'm writing this e-mail from a different machine I usually use, so I can
give you the detailed information right now, but stay tuned...

--
Kohsuke Kawaguchi <kohsuke.kawaguchi_at_sun.com>