P
PPA
Hi Guys
I am really new to XML/XSD and Castor. Could you please help me out
here?
I have following XSD:
-----------------------------XSD
STARTS-----------------------------------
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="valueType">
<xs:restriction base="xs:string">
<xs:enumeration value="string"/>
<xs:enumeration value="boolean"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="param">
<xs:attribute name="name" use="required" type="xs:string"></
xs:attribute>
<xs:attribute name="value" use="required" type="xs:string"></
xs:attribute>
<xs:attribute name="type" use="required" type="valueType"></
xs:attribute>
</xs:complexType>
</xs:schema>
------------------------------XSD
ENDS----------------------------------
I have generated the Java class against this xsd and the class Param
has following attributes
private java.lang.String _name;
private java.lang.String _value;
private com.test.types.ValueType _type;
Now, just to test I created the the java object Param, populate it
with name, value and type and then MARSHALL'ed it. The generated XML
does not have <type> tag at all.
Similarly if I create an XML with all three tags, and then unmarshall
it, for Param object, type is coming out to be NULL.
What is that I am missing? Please help.
Regards,
-PPA
I am really new to XML/XSD and Castor. Could you please help me out
here?
I have following XSD:
-----------------------------XSD
STARTS-----------------------------------
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="valueType">
<xs:restriction base="xs:string">
<xs:enumeration value="string"/>
<xs:enumeration value="boolean"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="param">
<xs:attribute name="name" use="required" type="xs:string"></
xs:attribute>
<xs:attribute name="value" use="required" type="xs:string"></
xs:attribute>
<xs:attribute name="type" use="required" type="valueType"></
xs:attribute>
</xs:complexType>
</xs:schema>
------------------------------XSD
ENDS----------------------------------
I have generated the Java class against this xsd and the class Param
has following attributes
private java.lang.String _name;
private java.lang.String _value;
private com.test.types.ValueType _type;
Now, just to test I created the the java object Param, populate it
with name, value and type and then MARSHALL'ed it. The generated XML
does not have <type> tag at all.
Similarly if I create an XML with all three tags, and then unmarshall
it, for Param object, type is coming out to be NULL.
What is that I am missing? Please help.
Regards,
-PPA