users@jaxb.java.net

Identifying anon simple types

From: Sachith Dhanushka <sachith.dhanushka_at_gmail.com>
Date: Sat, 7 Jul 2007 19:58:30 -0400

Hi,

I have an anon simple type defined as the following.

<xs:complexType name="bookType">
  <xs:sequence>
     ........
    <xs:element name="bookCategory">
       <xs:simpleType>
         <xs:restriction base="xs:NCName">
           <xs:enumeration value="magazine" />
           <xs:enumeration value="novel" />
           <xs:enumeration value="fiction" />
           <xs:enumeration value="other" />
         </xs:restriction>
      </xs:simpleType>
     </xs:element>
   </xs:sequence>
  ..........
</xs:complexType>

When I generated JAXB2 classes for the above schema, I get the Booktype
class with bookCategory attribute. The annotation of book category is

@XmlElement(required = true)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)

I am writing piece of code to look at the generated
classes and re-generate the schema. In the case how can I look at the
above annotations and deduce the anonymous simple type. Annotations
simply refer to a String adapter class without enums.

FYI : I am using JAXB2 reflections library to read the annotated classes.

Please help.

Thanks,
SD