Hello,
I am generating Castor objects from an XML schema that I cannot change.
Most of the elements in the schema are defined such that the element
itself has no value, with the actual value being contained in an
attribute:
<xsd:complexType name="VersionType">
<xsd:annotation>
<xsd:documentation>
<Uid>ET0002</Uid>
<Definition>A code...</Definition>
</xsd:documentation>
</xsd:annotation>
<xsd:attribute name="v" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:integer">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="999"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
The schema then has an element as such:
<xsd:element name="MessageVersion"
type="ecc:VersionType">
<xsd:annotation>
<xsd:documentation/>
</xsd:annotation>
</xsd:element>
The xml data file being unmarshalled has the element:
<MessageVersion v="1"/>
When I unmarshall this file and call getMessageVersion() I am getting null
in return. This makes it impossible to read the attribute value in the
MessageVersion object.
Is there a way to get Castor to create a MessageVersion object on the
unmarshall so I can retrieve the attribute value?
Thanks,
Dan :)