[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] targetNamespace and default namespace
- From: Michael Kay <mike@saxonica.com>
- To: Thomas Passin <list1@tompassin.net>
- Date: Thu, 29 Sep 2016 16:26:31 +0100
> On 29 Sep 2016, at 16:07, Thomas Passin <list1@tompassin.net> wrote:
>
> I have always understood that the elementFormDefault only applies to the way that the element names are written *in the schema*; if there is a target namespace specified, then all elements defined in the schema (and not otherwise namespaced or referenced) must be in that namespace in an instance document, unrelated to the value of elementFormDefault.
>
No, that's incorrect. If you specify form="unqualified", or by implication elementFormDefault="unqualified", which is its default value, then local element declarations describe elements whose names are in no namespace.
Chapter and verse: XSD 1.0 part 1 §3.3.2,
Element information items ·validated· by a top-level declaration must be qualified with the {target namespace} of that declaration (if this is ·absent·, the item must be unqualified). Control over whether element information items ·validated· by a local declaration must be similarly qualified or not is provided by the form [attribute], whose default is provided by the elementFormDefault [attribute] on the enclosing <schema>, via its determination of {target namespace}.
which says that if form=unqualified (explicitly or implicitly) the element information item to be validated must be unqualified, which is XSD's way of saying it must be in no namespace.
Someone, I think, had the bright idea that if a container element is in a namespace
<svg:svg xmlns:svg="http://svg.com/">
<rectangle/>
<circle/>
</svg:svg>
then there is no good reason why its children need to be in a namespace: like attributes, they are scoped by the container. The idea didn't catch on, but the schema spec was written in the belief that this was the way forwards.
Michael Kay
Saxonica
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]