[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: What's wrong with namespaces? Some observations and sugges

  • From: Dimitre Novatchev <dnovatchev@gmail.com>
  • To: Michael Kay <mike@saxonica.com>
  • Date: Sun, 5 Dec 2010 16:55:35 -0800

Re:  What's wrong with namespaces? Some observations and sugges
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]


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.