Re: Validation with <xs:anyAttribute namespace="##other"/>

Hi Max,

> Example:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <root xmlns="myNS" xmlns:zzz="myNS-zzz"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="myNS faultxsd.xsd" validAtt="aaa"
> undeclared:invalid="bbb" justInvalid="ccc">
>         <zzz:invalid>ddd</zzz:invalid>
> </root>
>
> The document above is valid for the schema below according to XML
> Spy 4.3 with MS XML 4. To my understanding the document is not
> valid.

The document isn't valid according to the Namespace Recommendation,
because you haven't got a namespace declaration for the prefix
'undeclared'. Schema validators can only work on documents that adhere
to the Namespace Recommendation.

If you add that namespace declaration:

<root xmlns="myNS"
      xmlns:zzz="myNS-zzz"
      xmlns:undeclared="myNS-undeclared"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="myNS test.xsd" 
      validAtt="aaa"
      undeclared:invalid="bbb" 
      justInvalid="ccc">
  <zzz:invalid>ddd</zzz:invalid>
</root>

Then MSXML4 reveals three errors:

 - the attribute undeclared:invalid is not defined in the schema
 - the attribute justinvalid is not defined in the schema
 - the element zzz:invalid is used but not declared in the schema

which is what I'd expect from the schema that you've specified.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Tuesday, 12 March 2002 06:44:24 UTC