W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2010

Confused about instance validation

From: Pete Cordell <petexmldev@codalogic.com>
Date: Fri, 12 Feb 2010 12:33:56 -0000
Message-ID: <477A2A8D033C42D8814B0B8D45E2E919@Codalogic>
To: <xmlschema-dev@w3.org>
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:55 UTC