Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 352941 - Global Attributes in XSD Schema
Summary: Global Attributes in XSD Schema
Status: RESOLVED INVALID
Alias: None
Product: EMF
Classification: Modeling
Component: XSD (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Ed Merks CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-23 16:28 EDT by Frank Siegert CLA
Modified: 2023-01-12 11:53 EST (History)
1 user (show)

See Also:


Attachments
XSD Schema using global attributes (460 bytes, text/xml)
2011-07-23 16:31 EDT, Frank Siegert CLA
no flags Details
XML file using the XSD schema from test.xsd (552 bytes, text/xml)
2011-07-23 16:32 EDT, Frank Siegert CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Siegert CLA 2011-07-23 16:28:06 EDT
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
Comment 1 Frank Siegert CLA 2011-07-23 16:31:33 EDT
Created attachment 200236 [details]
XSD Schema using global attributes

test file to reproduce the error messages
Comment 2 Frank Siegert CLA 2011-07-23 16:32:34 EDT
Created attachment 200237 [details]
XML file using the XSD schema from test.xsd

test file to reproduce the error messages
Comment 3 Ed Merks CLA 2011-07-23 21:16:17 EDT
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.
Comment 4 Frank Siegert CLA 2011-07-24 11:32:27 EDT
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="...".