OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] What's wrong with namespaces? Some observations and suggestions

On Sun, Dec 5, 2010 at 3:41 PM, Michael Kay <mike@saxonica.com> wrote:
>> An interesting question is how we would write compact XPath
>> expressions for XML2:
>>      /*/head/body
>> should select the :org.w3c.html.body element.
>> Should we have to write:
>>     /*/head/body/:org.w3c.svg.svg
>> or
>> could it be:
>>     /*/head/body/:~svg.svg
> My suggestion would be:
> select=":org.w3c.html.table"
> selects an element with this precise name
> select="table"
> selects a table element in any namespace - that is, an element that has
> "table" as the final part of its name.
> Generally I think it's better if XPath is designed to over-retrieve rather
> than under-retrieve - it's easier for the user to see what they did wrong if
> they get too much data back than if they get nothing back.

Yes,  this principle  is absolutely necessary for a single location step.

When evaluating an expression containing more than one location step a
useful convention can be used:

... /Name1/Name2

Select all "Name2" elements that are children of "Name1" elements and
are in the same namespace as their parents.

That is,  it is necessary to specify the full namespace or a part of
it on a child element, only if the child element is not in the same
namespace as the parent element.

In this way,


selects the


element. Here the top element, its child "head" and its child "body"
all are in the "org.w3c.html" namespace.

On the other side:


selects nothing, because the "svg" element isn't in the namespace
("org.w3c.html" ) of its parent.

To select the "svg" element, either its full namespace or a part of
the full namespace that is unique among all namespaces needs to be


fully specified namespace,



partially specified namespace.

If we need to select all children of "Name1" regardless of their
namespace, we have this natural notation:


Using these rules results in a compact and convenient to use
expression language while it still permits any more verbose form to be

Dimitre Novatchev
Truly great madness cannot be achieved without significant intelligence.
To invent, you need a good imagination and a pile of junk
Never fight an inanimate object
You've achieved success in your field when you don't know whether what
you're doing is work or play

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS