XML Schema editor sees "form" as a failure [message #1784640] |
Sat, 31 March 2018 14:48 |
Rolf Schumacher Messages: 60 Registered: January 2014 |
Member |
|
|
Using "Eclipse Editor and Tools" 3.9.2, experimenting with namespaces in XML schema:
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:a="http://exmaple.com/v0_0_1"
elementFormDefault="qualified">
<import namespace="http://example.com/v0_0_1" schemaLocation="a.xsd" />
<element name="root" form="unqualified">
<complexType>
<sequence>
<element name="elA" type="a:A" />
<element ref="a:aEl"/>
</sequence>
</complexType>
</element>
</schema>
I get a failure message about form attribute at line 4:
s4s-att-not-allowed: Attribute 'form' cannot appear in element 'element'.
Why shouldn't I use that form attribute there?
How to unqualify that element otherwise?
Validation against that schema works fine.
[Updated on: Sat, 31 March 2018 14:52] Report message to a moderator
|
|
|
Re: XML Schema editor sees "form" as a failure [message #1784651 is a reply to message #1784640] |
Sun, 01 April 2018 07:41 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
This is the JDT forum so it's not really an appropriate question for there.
As you know, the form attribute is used to affect the namespace of the element, but note that for a global element, i.e., one not nested in a particle of a model group or complex type, the target namespace is always defined to be that of the schema:
https://www.w3.org/TR/xmlschema-1/#e-target_namespace
In section https://www.w3.org/TR/xmlschema-1/#element-element where it says "otherwise if the <element> element information item has <complexType> or <group> as an ancestor and the ref [attribute] is absent, the corresponding schema components are as follows" where it then mentions "{target namespace} If form is present and its ·actual value· is qualified, or if form is absent and the ·actual value· of elementFormDefault on the <schema> ancestor is qualified, then the ·actual value· of the targetNamespace [attribute] of the parent <schema> element information item, or ·absent· if there is none, otherwise ·absent·."
So no, a global element always is qualified by the schema's target namespace, you cannot use the form attribute in that context/scope, so you can only define unqualified global elements in the no-namespace schema.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Re: XML Schema editor sees "form" as a failure [message #1796474 is a reply to message #1796473] |
Sun, 14 October 2018 15:11 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
No, you can't describe/define different namespaces in one schema. Each namespace needs to be described/defined by one or more schemas with that target namespace. Only elements defined local to a complex type can choose whether they are qualified by the schema's target namespace or not, but if you want them to be qualified with some other namespace, they must be define in a schema for that namespace and be referenced.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03989 seconds