[RE: Conditional typing] xsi:type not checked against schema

Hello again,

(Eric, I have upgraded to XML Spy 4.3 and it works nearly fine now...)

When using xsi:type in an instance document, the validation checks that the
value of the tag is valid, but the type specified is not checked against the
schema.

For instance, my "element" is of type "valueType" which is a union of
base64Binary and string.

In an instance document, any xsi:type is accepted.

schema :
	<xs:element name="root">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="element"
type="valueType"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:simpleType name="valueType">
		<xs:union memberTypes="xs:base64Binary xs:string"/>
	</xs:simpleType>


valid instance :

	<element xsi:type="xs:int">1</element> 
	<element xsi:type="xs:boolean">1</element> 
	<element xsi:type="xs:string">hello world</element> 

- As far as I understand, only xs:string and xs:base64Binary should be
accepted. Is that true ?
- Is there a way to make the xsi:type attribute compulsory ?

Thanks for your support

Régis

Received on Monday, 11 February 2002 08:18:07 UTC