Why do <user> elements must also be prefixed? isn't the prefix on applicationUsers supposed to automatically make all child elements to be associated to abc?
the second question is, is it possible for a single element to be associated to multiple namespace?
David Spades wrote:Why do <user> elements must also be prefixed? isn't the prefix on applicationUsers supposed to automatically make all child elements to be associated to abc?
Namespace declaration is one thing; element name (prefixed or not and in the latter case with or without default namespace declaration) is another. You should rather reason along like this: namespace declaration of an element makes the declaration "in-scope" for all its descendant elements until countered by another declaration changing its status. It being in-scope does not make it automatic such that the descendants live in that namespace - and the namespace declaration can be multiple in the root - the top element of that tree, and by this fact itself, it is already clear that reasoning wouldn't hold. Making a descendant be in a namespace is a positive action taken by the author(s) of the document - one by one, and each one counts. It must be explicit.
Default namespace is only a shorthand to spare the author(s) of the document the trouble of making an element's name fully qualified via a prefixed so defined in the declaration. Nothing less and nothing more. It does not carry the meaning of being default of something for its descendants.
The prefix itself has no generic significance, it is the namespace uri that counts.
David Spades wrote:Also, I have seen that it's possible for an element to have one namespace while its attributes to have other namespace. How does that work?
In the majority of cases, you would see an attribute of an element carries no prefix. Even if there were a default namespace in the scope, it does _not_ mean the attribute lives in that default namespace. As a rule, all attributes living in a non null namespace _must_ be prefixed and the prefix declared. There is no such thing as the default namespace for an attribute.
An attribute of name without prefix in principle lives in empty (or null) namespace. It could be "attached" to an element in the sense of its being defined in the schema where the attaching element is being defined.
If an attribute is prefixed, that attribute _must_ be defined in an schema validating that namespace as a top-level element inside the schema. That is how it works in the perspective of xml document with a validating schema.
At the beginning where no conscious is required on how w3c schema works, some of the light on how and why xml document looks like what it looks like might not come out to the light very easily. It therefore requires multi-pass to understand the various facets of it. It is hard to force the thing. It would come naturally.