Community
Participate
Working Groups
Build Identifier: 20110615-0604 A XSD schema definition using global attributes can't currently be validated correctly. The validation ends in a conflict that on the one hand the described attribute is required and on the other hand not allowed to be used. The following error messages are the results: cvc-complex-type.3.2.2: Attribute '...' is not allowed cvc-complex-type.4: Attribute '...' must appear on element '...'. Reproducible: Always Steps to Reproduce: 1. put the attached file test.xsd into a project 2. put the attached file test.xml into a project 3. validate test.xml against test.xsd
Created attachment 200236 [details] XSD Schema using global attributes test file to reproduce the error messages
Created attachment 200237 [details] XML file using the XSD schema from test.xsd test file to reproduce the error messages
The file isn't valid. The attribute must be qualified with its namespace. The declaration xmlns="..." only provides an implicit namespace for elements in the contained XML. They do not implicitly provide the namespace for attributes. So it's impossible to have a qualified attribute in the instance unless you use an explicit named prefix for that namespace.
Thanks for pointing this out. To use global attributes unqualified I had to remove the target name space from the XSD schema. As a result in the instance document no name space needs to be defined and the XSD schema has to be referenced by xsi:noNamespaceSchemaLocation="...".