xs:any and Validation
Can anyone help me out by clarifying what the correct behavior should be for an XSD validator in the prescence of xs:any?
Imagine I had the following schema:
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema
targetNamespace="http://www.winterdom.com/schemas/valprb1"
elementFormDefault="qualified"
xmlns="http://www.winterdom.com/schemas/valprb1"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:element name="test">
<xs:complexType>
<xs:sequence>
<xs:element name="value1" type="xs:string"/>
<xs:any namespace="##any" processContents="skip" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
And the following XML:
<test xmlns="http://www.winterdom.com/schemas/valprb1">
<value1>whatever</value1>
<!-- Should fit in xs:any -->
<s:other xmlns:s="http://www.winterdom.com/schemas/other">asdad</s:other>
</test>
What should the correct behavior be here regarding the validation of s:other given my specification of processContents="skip"? I'm not quite entirely sure of what the XSD specification implies. My initial understanding would've been that the validator should not try to actually validate anything fitting in the xs:any section, just verify that it is indeed valid XML. However, this seems not to be the case, at least for the .NET XmlValidatingReader, which reports:
Error: Could not find schema information for the element 'http://www.winterdom.com/schemas/other:other'. An error occurred at file:///C:/temp/test.xml(4, 5).
The message obviously points out that I haven't given any schema information for s:other, but my question goes towards the why I should have to do it? If I was using skip?
So I'm probably misunderstanding how things are supposed to work, and I'd love it if someone would point me out in the right direction...






you seen to be right, does lax work any better ?
Nope. It gives the same error.
I used .NET 1.1 and it worked just fine. Should be a bug on 1.0. Note that Xerces-J also says that it validates. So it is not you who mistakes.
http://support.microsoft.com/default.aspx?scid=kb;en-us;317353
Thanks for confirming it as a bug, Dare!