- From: Pete Cordell <petexmldev@codalogic.com>
- Date: Mon, 27 Oct 2008 16:32:07 -0000
- To: "Kresimir Karamazen" <k.karamazen@trinite.nl>, <xmlschema-dev@w3.org>
> To be able to understand clearly the meaning of elementFormDefault > I have written a short reminder. Hi, I don't think you have quite got this correct. With elementFormDefault="qualified", then locally defined elements are associated with a namespace. This means they either have a namespace prefix (as in pre:elm1) or they are associated with the default namespace (and appears like elm1). It is the latter case where I think you are not quite right. Where the element's parents come into play is that the namespace to prefix mapping can be specified in a parent. For example, the following XML snippets are logically equivalent: <pre:parent xmlns:pre="http://myurl"> <pre:elm1>foo</pre:elm1> </pre:parent> <parent xmlns="http://myurl"> <elm1>foo</elm1> </parent> Also, if you had the following: <pre:parent xmlns:pre="http://myurl" xmlns="http://myotherurl"> <elm1>foo</elm1> </pre:parent> ele1 would be in the http://myotherurl namespace rather than in the http://myurl namespace (the namespace of the parent). If you had: <pre:parent xmlns:pre="http://myurl"> <elm1>foo</elm1> </pre:parent> then, assuming parent's parents didn't define a default namespace mapping, then elm1 would be in the empty namespace rather than the http://myurl namespace. In other words, elm1 without a prefix does NOT adopt the namespace of its parent. (It might have been useful if it did, but it doesn't and that's that!) In this case, if the XSD schema specified elm1 should be qualified, then elm1 in the above XML instance would not be associated with the qualified element declaration for elm1. 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: "Kresimir Karamazen" <k.karamazen@trinite.nl> To: <xmlschema-dev@w3.org> Sent: Monday, October 27, 2008 10:23 AM 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:33:04 UTC