users@jaxb.java.net

Problem in converting fixed attribute of element tag as constant in JAXB

From: Kaushal kumar <kaushal.nith_at_gmail.com>
Date: Tue, 26 Jul 2011 09:11:37 -0700 (PDT)

Hi,
I have a schema defined as given below
<!-- base complex type-->
<xsd:complexType name="ArchiveConfiguration">
        <xsd:sequence>
                <xsd:element name="status" type="xsd:string" minOccurs="1"
maxOccurs="1"/>
                <xsd:element name="duration" type="xsd:nonNegativeInteger" minOccurs="1"
maxOccurs="1"/>
        </xsd:sequence>
</xsd:complexType>

<!-- specific complex type-->
<xsd:complexType name="DefaultArchiveConfiguration">
        <xsd:complexContent>
                <xsd:restriction base="ArchiveConfiguration">
                        <xsd:sequence>
                                <xsd:element name="status" type="xsd:string" minOccurs="1"
maxOccurs="1" fixed="*"/>
                                <xsd:element name="duration" type="xsd:nonNegativeInteger" minOccurs="1"
maxOccurs="1"/>
                        </xsd:sequence>
                </xsd:restriction>
        </xsd:complexContent>
</xsd:complexType>
        

There is a base type and then a specific type (DefaultArchiveConfiguration)
which is extension of base type.
Using this schema I am creating jaxb classes (with help of xjc), but I am
not getting anything specific to fixed attribute in
DefaultArchiveConfiguration.

I expect that xjc should create two classes
1. ArchiveConfiguration with two instance variables (status and duration,
with corresponding setter and getter)
2. DefaultArchiveConfiguration (which extends ArchiveConfiguration) and
getStatus as overridden (returning just the fixed value)

Do you think my expectation is correct. If yes, how can we achieve this.
-- 
View this message in context: http://old.nabble.com/Problem-in-converting-fixed-attribute-of-element-tag-as-constant-in-JAXB-tp32141465p32141465.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.