users@jaxb.java.net

JAXB 2.0 substitutionGroup and common type

From: Simon Hutchinson <Simon.Hutchinson_at_misgl.com>
Date: Wed, 17 Aug 2005 14:59:30 +0100

Hi,

 

<xs:element name="elem1" type="xs:string"/>

<xs:element name="elem2" substitutionGroup="elem1"/>

      

<xs:element name="Test1">

      <xs:complexType>


            <xs:sequence>

                  <xs:element name="fault" type="common:Fault"
minOccurs="0"/>

                  <xs:element ref="elem1">

                        <xs:annotation>

                              <xs:appinfo>

                                <jxb:property name="element"/>

                              </xs:appinfo>

                         </xs:annotation>

                  </xs:element>

            </xs:sequence>

      </xs:complexType>

</xs:element>

 

 

My schema (snippet shown above) compiles OK.

However the addidtion of the substitutionGroup for "elem2" has raised an
issue for me.

 

A call to the getElement() property in the XJC generated class returns a
javax.xml.bind.JAXBElement - I can subsequently call getValue() on this
element to return the string. However I know that this element will only
ever return a String type. Is there any way that I can force the
compiler to allow getElement() to return a string as opposed to a
JAXBElement?

 

Thanks

 

Si
 
 
-- 
 
Merlin Information Systems Limited,
Merlin House, Gawcott Road, Buckingham, United Kingdom. MK18 1TN
Tel: +44 (0) 1280 824331 Fax: +44 (0) 1280 824112
 
http://www.misgl.com
 
Provider of IT Services and Online Portal Support Services. 
 
Confidentiality:
The information contained in this email (including any attachments) is confidential and is intended solely for the use of the named addressee. Access, copying or re-use of the information in it by any other person is not authorised. If you are not the intended recipient, please notify us immediately by telephone or by e-mail to admin_at_misgl.com
 
*** This mail has been scanned for viruses ***