Stan Kitsis, who replaced me as the XML Schema program manager on the XML team, has
a blog post about XInclude
and schema validation where he writes
A lot of people are excited about XInclude and want to start using it in their projects.
However, there is an issue with using both XInclude and xsd validation at the same
time. The issue is that XInclude adds xml:* attributes to the instance documents while
xsd spec forces you to explicitly declare these attributes in your schema. Daniel
Cazzulino, an XML MVP, blogged about this a few months ago: "W3C
XML Schema and XInclude: impossible to use together???"
To solve this problem, we are introducing a new system.xml validation flag AllowXmlAttributes
in VS2005. This flag instructs the engine to allow xml:* attributes in the instance
documents even if they are not defined in the schema. The attributes will be validated
based on their data type.
This design flaw in the aforementioned XML specifications is a showstopper that prevents
one from performing schema validation using XSD on documents that were pre-processed
with XInclude unless the schema designer decided up front that they want their format
to be used with XInclude. This is fundamentally broken. The sad fact is that as Norm
Walsh pointed out in his post XInclude,
xml:base and validation this was a problem the various standards groups were aware
of but decided to dump on implementers and users anyway. I'm glad the Microsoft XML
team decided to take this change and fix a problem that was ignored by the W3C standards
groups involved.