Namespaces (Was: Re: [Xpath-ng] Thoughts on work products)

Jeni Tennison jeni at jenitennison.com
Fri Nov 22 10:58:40 MST 2002


Hi David,

>> If we allowed lists of lists then we could store namespace
>> associations as lists of lists rather than as separate nodes in the
>> data model. That could reduce overhead but doesn't get away from
>> some of the sticky issues that namespaces raise.
>
> I don't see how this would reduce overhead. Namespace mappings are
> specific pieces of information that appears in every document so why
> not have a specific construct for it in the data mocdel? I think
> that using generic structures for this might actually increase
> overhead.

I thought that holding something as a node was quite a large overhead
because of retaining node identity. But that's just a vague feeling
and I can't remember where I picked it up from.

>> I agree that a default namespace for element names leads to
>> complications (because if you declare a default element namespace
>> then suddenly you can't talk about elements in no namespace at all)
>> but it's a usability boon, especially for novices. The default
>> namespace for type names follows the same argument.
>
> It leads to complications, but you could take the path the RELAX NG
> compact syntax has taken by allowing namespace local = "" and then
> local:foo. I'm not sure this is good in an XPath context, but I
> think it works well in the RELAX NG context.

That solution would work if you weren't embedding XPath in XML, but
currently, you're not allowed to do:

  xmlns:local=""

at all, and under the namespaces 1.1 WD, doing it undeclares the
'local' prefix rather than associating the 'local' prefix with no
namespace.

Certainly that isn't an impossible thing to get around, whether by
declaring namespaces within XPath or by introducing an extension
attribute that declares namespaces in XSLT, but I'd be wary of
solutions that *rely* on being able to do it.

Personally I view the default element and type namespaces as being
useful crutches for novice users, but ones that they shouldn't use
once they're steady on their feet.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/




More information about the Xpath-ng mailing list