users@jaxb.java.net

Property Binding and ref's

From: Burnett, Stewart <stewart.burnett_at_cgey.com>
Date: Thu, 24 Apr 2003 18:30:17 +0100

I'm having a problem with property bindings with ref= element definitions;

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:rs="http://xxx/CC" targetNamespace="http://xxx/CC"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb" jxb:version="1.0">

<xs:element name="CC">
  <xs:annotation><xs:appinfo><jxb:class name="Cancel"
/></xs:appinfo></xs:annotation>
  <xs:complexType>
    <xs:sequence>
      <xs:element ref="rs:Ref" minOccurs="1" maxOccurs="1">
         <xs:annotation><xs:appinfo><jxb:property name="Reference"
/></xs:appinfo></xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:element>

<xs:element name="Ref">
  <xs:annotation><xs:appinfo><jxb:class name="Reference"
/></xs:appinfo></xs:annotation>
  <xs:complexType>
    <xs:attribute name="no" type="xs:string" use="required">
      <xs:annotation><xs:appinfo><jxb:property name="number"
/></xs:appinfo></xs:annotation>
    </xs:attribute>
  </xs:complexType>
</xs:element>

</xs:schema>

This gives an error on the annotation line;

[ERROR] Specified property customization is not used.
  line 9 of CC.xsd

Without this line I get a get/setRef method, when I'd prefer a
get/setReference.

If I use the following schema (fine for a simple example);

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:rs="http://xxx/CC" targetNamespace="http://xxx/CC"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb" jxb:version="1.0">

<xs:element name="CC">
  <xs:annotation><xs:appinfo><jxb:class name="Cancel"
/></xs:appinfo></xs:annotation>
  <xs:complexType>
    <xs:sequence>
      <xs:element name="Ref">
        <xs:annotation><xs:appinfo><jxb:class name="Reference"
/></xs:appinfo></xs:annotation>
        <xs:complexType>
          <xs:attribute name="no" type="xs:string" use="required">
            <xs:annotation><xs:appinfo><jxb:property name="number"
/></xs:appinfo></xs:annotation>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:element>

</xs:schema>

I can persuade JAXB be to give me my get/setReference methods.

Is this binding possible when using references in the schema?

Stewart Burnett

-----Original Message-----
From: Douglas Jackson [mailto:douglasscottjackson_at_yahoo.com]
Sent: 03 April 2003 19:03
To: JAXB-INTEREST_at_JAVA.SUN.COM
Subject: Re: Serial UIDs


When generating the serializable classes from
JAXB, the Reference Implementation generates a
Serial UID that is private. We are extending
the JAXB classes and would like to serialize
our classes. Rather than having to add serial
UIDs to all our classes it would be nice to
inherit them from the JAXB generated classes.
Or, to define the serial uid in our base
class (JAXB super class).
However, if we add a protected or public static
serial uid to our base class I believe we will
get compile errors. The JAXB implementations which
extend our base class will redefine a public member
as private.
Also if you dont specify the serial uid in the
bindings, it creates one for you with a value of 1
(according to my colleague). If we could shut off
the generation of the serial UID we could define
a public one in our base class and all jaxb generated
classes and our extending classes would inherit it.
Thanks!
-Doug.

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com


********************************************************************************************
" This message contains information that may be privileged or confidential and
is the property of the Cap Gemini Ernst & Young Group. It is intended only for
the person to whom it is addressed. If you are not the intended recipient, you
are not authorized to read, print, retain, copy, disseminate, distribute, or use
this message or any part thereof. If you receive this message in error, please
notify the sender immediately and delete all copies of this message ".
********************************************************************************************