I'm trying to use xsd.exe to generate a schema for this class.
publicclassTest
{
[
XmlAttribute(AttributeName = "noNamespaceSchemaLocation", Namespace = "http://www.w3.org/2001/XMLSchema-instance")] publicstring noNamespaceSchemaLocation;}
When xsd.exe attempts to generate the schema, it fails.
Error: There was an error processing 'XmlTest.exe'.
- Schema item 'attribute' named 'noNamespaceSchemaLocation' from namespace 'http://www.w3.org/2001/XMLSchema-instance'. The target namespace of an attribute declaration, whether local or global, must not match http://www.w3.org/2001/XMLSchema-instance.
- The target namespace of an attribute declaration, whether local or global, must not match http://www.w3.org/2001/XMLSchema-instance.
I checked the specification (http://www.w3.org/TR/xmlschema-1/#coss-attribute) and noticed a slight difference--my emphasis in bold.
The {target namespace} of an attribute declaration, whether local or top-level, must not match http://www.w3.org/2001/XMLSchema-instance (unless it is one of the four built-in declarations given in the next section).
The noNamespaceSchemaLocation attribute is one of the declartions referenced in the "next section". Is this a bug in xsd.exe? Is there a fix available?