Re: elementFormDefault

Since Kresimir described both elementFormDefault qualified and unqualified 
in his original post I think its worth clarifying that the case Michael 
described is when elementFormDefault="qualified".

Note that an elements 'form' attribute can override the value of 
elementFormDefault for that element, so it's not totally down to the value 
of elementFormDefault.  That said I don't think I've ever seen the 'form' 
attribute used.

HTH,

Pete Cordell
Codalogic Ltd
Interface XML to C++ the easy way using XML C++
data binding to convert XSD schemas to C++ classes.
Visit http://www.codalogic.com/lmx/ for more info

----- Original Message ----- 
From: "Michael Kay" <mike@saxonica.com>
To: "'Kresimir Karamazen'" <k.karamazen@trinite.nl>; <xmlschema-dev@w3.org>
Sent: Monday, October 27, 2008 4:10 PM
Subject: RE: elementFormDefault





I think you've grasped it, but your terminology isn't quite right.

Firstly, it's all to do with whether or not the element is in a namespace,
which isn't quite the same as whether or not it has a prefix. An element
name with no prefix can still be in a namespace.

The rule is this. If the schema contains

 <xs:element name="x"/>

as a local element declaration (that is, not a child of <xs:schema>), then
the element must be in the target namesapce of the containing schema
document, if there is one. For example, if the target namespace is
http://target.com/, then the element might validly appear as

  <x xmlns="http://target.com/"/>

or

  <ppp:x xmlns:ppp="http://target.com/"/>

Of course the namespace declaration does not have to be on the <x> element
itself, it can be on any ancestor.

If the schema document does not have a target namespace, then it doesn't
matter whether the element form is qualified or unqualified.

Michael Kay
http://www.saxonica.com/


> -----Original Message-----
> From: xmlschema-dev-request@w3.org
> [mailto:xmlschema-dev-request@w3.org] On Behalf Of Kresimir Karamazen
> Sent: 27 October 2008 10:24
> To: xmlschema-dev@w3.org
> Subject: elementFormDefault
>
>
>
> To be able to understand clearly the meaning of
> elementFormDefault I have written a short reminder.
> Could you please tell me if the following doesn't hold true?
>
> When we have
>
> elementFormDefault="qualified"
>
> in some scope then in the scope: a locally declared element
> elm1 must appear with a prefix (i.e. pre:elm1) or otherwise
> it must be implicitly in a namespace of the parent element.
> This means that a locally declared element elm1 in such a
> scope (and unless it is used as a root element, what is
> anyway not the intention) will never violate the "qualified"
> restriction because if it does not have a prefix than it has
> an implicit namespace of the parent (which (namespace of the
> parent) may be empty). However it can happen that the
> instance does not validate if the elm1 has not been declared
> in that namespace.
>
> When we have
>
> elementFormDefault="unqualified"
>
> in some scope then in the scope: a locally declared element
> elm1 is not allowed to appear with a prefix (i.e. unallowed
> is pre:elm1) .
>
>
>
> ______________________________________________________________
> __________
>
> K.Karamazen
> Trinité Automatisering B.V.
> Post-adres:  Postbus 189, 1420 AD Uithoorn
> Bezoek-adres: J.N. Wagenaarweg 6, 1422 AK Uithoorn Tel. : 0297 382460
>
> Fax : 0297 273049
> Email: kk@trinite.nl
> Website: www.trinite.nl
>
>
>

Received on Monday, 27 October 2008 16:45:27 UTC