by use of command line tool 'xjc' example, possible create java classes existing xml schema.
i've tried simple xml schema before:
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:element name="employee" type="employee"/> <xs:complextype name="employee"> <xs:sequence> <xs:element name="name" type="xs:string" minoccurs="0"/> <xs:element name="salary" type="xs:double"/> <xs:element name="designation" type="xs:string" minoccurs="0"/> <xs:element name="address" type="address" minoccurs="0"/> </xs:sequence> <xs:attribute name="id" type="xs:int" use="required"/> </xs:complextype> <xs:complextype name="address"> <xs:sequence> <xs:element name="city" type="xs:string" minoccurs="0"/> <xs:element name="line1" type="xs:string" minoccurs="0"/> <xs:element name="line2" type="xs:string" minoccurs="0"/> <xs:element name="state" type="xs:string" minoccurs="0"/> <xs:element name="zipcode" type="xs:long"/> </xs:sequence> </xs:complextype> </xs:schema>
but when add definition has restrictions, restrictions ignored. example:
<xs:element name="temperature" type="mytemperature"/> <xs:simpletype name="mytemperature"> <xs:restriction base="xs:double"> <xs:minexclusive value="-273.15"/> </xs:restriction> </xs:simpletype>
or
<xs:element name="age"> <xs:simpletype> <xs:restriction base="xs:integer"> <xs:mininclusive value="0"/> <xs:maxinclusive value="100"/> </xs:restriction> </xs:simpletype> </xs:element>
all restrictions mininclusive, maxinclusive, maxlength, totaldigits, etc. ignored. there way include restrictions in creation of java classes xml schema?
Comments
Post a Comment