Out of the Angle Brackets
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. What follows is a brief description of how the validation engine behaves when this flag is turned on (which is by default).
The flag is added to the XmlSchemaValidationFlags.
When schema doesn’t import xml namespace
When schema imports xml namespace without a location
When schema imports a custom xml namespace schema with a custom schemaLocation
When schema defines an xml:* attribute with use=”required”
This case applies to both AllowXmlAttributes=true and AllowXmlAttributes=false. Required xml:* attributes are treated as other attributes and validated using specified xml namespace schema.
When schema defines an xml:* attribute with use=”prohibited”
This case applies to both AllowXmlAttributes=true and AllowXmlAttributes=false. If instance document contains xml:* attributes that are explicitly prohibited by the schema, validation engine will report an error.
When schema specifies an attribute wildcard
Qeustions? Comments? Let us knowStan Kitsis