substitutionGroup and anyType

With this schema (called AnyType.xsd):

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">

     <xs:element name="item" type="xs:anyType" abstract="true"/>

     <xs:element name="library" type="xs:string" substitutionGroup="item"/>

</xs:schema>

this file

<?xml version="1.0" encoding="UTF-8"?>

<library xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="AnyType.xsd">

Text

</library>



Validates fine in XML-Spy, Topologi Schematron Validator (uses MSXML 4.0), using JAXP/Xerces2 but not using .NET validator which gives the error message 



    'library' cannot be a member of the substitution group with head element 'item'. An error occurred at file:///C:/temp/AnyType.xsd(4,2)



Which is right?



Thanks



Hugh Wallis

Received on Wednesday, 12 February 2003 11:38:49 UTC