users@jaxb.java.net

[jaxb-2.x] Cannot attach jaxb annotations to 'ref' elements

From: Kostis Anagnostopoulos <ankostis_at_gmail.com>
Date: Wed, 31 Jan 2007 19:44:41 +0200

Hi,

(I'm resending this since i got no answer at all)

I cannot attach a jaxb-2.x customization on an element defined using
'ref' that refers to an element defined into some ther schema
(different file and namespace).

For instance, the following 2 schema extracts would generate errors on
the 'property' jaxb customization:

SCHEMA FILE: foo.xsd
<xsd:schema
  xmlns:xsd="..."
  xmlns:foo="http://bar.com"
  xmlns:jaxb="..."
  targetNamespace="http://foo.com"
  />

   <xsd:import namespace="http://bar.com" schemaLocation="bar.xsd" />

  <xsd:complexType name="parentType">
    <xsd:sequence>
      <xsd:element ref="foo:someElement" >
        <xsd:annotation>
          <xsd:appinfo>
          <jaxb:property ..../>
          </xsd:appinfo>
        </xsd:/annotation>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>

SCHEMA FILE: bar.xsd
   ....
  <xsd:element xmlns="http://bar.com" name=someElement">
    ....
  </xsd:element>

I've attached an archived sample using maven2 manifesting my problem:
  hyperjaxb3-ankostis-ref-problem.tgz (14kb)

Although it uses the hj3, since the jaxb customizations are the cause
of the problem, i think the sample is appropriate.

Note that i have found the following old thread (from 2003) refering
to the same problem .
https://jaxb.dev.java.net/servlets/ReadMsg?listName=users&msgNo=1228

Any help appreciated.

Regards,
  Kostis