[XML-SIG] Default namespaces, attributes, 4DOM and the W3C recommendation

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Thu, 27 Sep 2001 08:08:39 +0200


> But, back to vague relevance for this list, does anyone have any
> hands-on experience with namespace processing along these lines?
> Might there be any plans in the PyXML world to possibly provide
> "helper methods" to find the meaning of attributes where such a
> meaning is inferred from the namespace of the parent element?
> Finally, is it reasonable to infer "meaning" in such a way?

It is certainly possible to infer the meaning of an attribute without
namespace from the parent element. However, this cannot be done in a
general way; it is always application specific.

Please try to think of XML applications as processors: They want to
achieve some goal (e.g. produce some output). For that, they need to
gather information from the input document. If this information
happens to live in attributes, they need to know which attributes they
expect the information in; this includes the namespace of the
attributes (if any), and the elements of which they are attributes.

It may be that the processor also needs to establish the "correctness"
of the input somehow. In that case, it would be reasonable to require
that it "understands" all pieces of information. Then, it ought to
complain about attributes it doesn't know in context of their element;
a namespace on the attribute may help to ignore the context of the
element.

> Right now, I have to mandate that the XMLForms namespace be the
> default namespace in a document, because the above issue made it
> unclear how one should properly handle cases such as those I gave in
> my examples. It would be great, for a number of reasons, to remove
> this restriction.

If you consider this desirable, you may want to reconsider whether
namespaces are a good thing in the first place. In XML namespaces, you
really have to have a namespace on each element. Whether this happens
by means of a default namespace, or by means of tagging each element
with a namespace, are your only options.

If inconvenience is a reason: it is common to pick a single-letter
prefix, e.g. "f" if you have to type it frequently.

Regards,
Martin