Confused about instance validation

I have the following schema:

  <xs:schema
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     targetNamespace="http://codalogic.com/schemas/UnexpectedAttribute.xsd"
     xmlns="http://codalogic.com/schemas/UnexpectedAttribute.xsd"
     elementFormDefault="qualified">

     <xs:element name="MyElement" type="MyType"/>

     <xs:complexType name="MyType"/>
  </xs:schema>

And then the following XML instance:

  <MyElement xmlns="http://codalogic.com/schemas/UnexpectedAttribute.xsd"
      AnAttribute="AnAttribute"/>

Both Microsoft and XSV report the instance as invalid because the attribute 
is unexpected.

However, I would have thought that MyType is effectively xs:anyType which 
allows an attribute wildcard with any namespace and lax processing.  Hence 
the instance should be valid.

Does anyone have any opinions?

Thanks,

Pete Cordell
Codalogic Ltd
Interface XML to C++ the easy way using XML C++
data binding to convert XSD schemas to C++ classes.
Visit http://codalogic.com/lmx/ or http://www.xml2cpp.com
for more info

Received on Friday, 12 February 2010 12:34:47 UTC