Could someone please point me in the right direction.
I have an XSD file which declares an element of type Location:
Note, the autologid element is of type optionalIntType which is intended to restrict values to integer types but allow empty values. I.e. an empty string or an integer.
Unfortunately when I run my XML through he XSD I get an exception:
Can anyone tell me how to declare my optionalIntType type so that it allows either an empty value or an integer please ?
Thanks
Smeat
I have an XSD file which declares an element of type Location:
Code:
<xs:element name="location">
<xs:complexType>
<xs:sequence>
<xs:element name="autologid" type="optionalIntType"/>
<xs:element name="locationname" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Note, the autologid element is of type optionalIntType which is intended to restrict values to integer types but allow empty values. I.e. an empty string or an integer.
Code:
<xs:simpleType name="optionalIntType">
<xs:union memberTypes="xs:integer">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="0"/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
Unfortunately when I run my XML through he XSD I get an exception:
Code:
Child node autologid below parent node location does not contain a value
Can anyone tell me how to declare my optionalIntType type so that it allows either an empty value or an integer please ?
Thanks
Smeat