W3C home > Mailing lists > Public > w3c-ietf-xmldsig@w3.org > July to September 2000

XPath question

From: Gregor Karlinger <gregor.karlinger@iaik.at>
Date: Thu, 7 Sep 2000 13:39:17 +0200
To: "XMLSigWG" <w3c-ietf-xmldsig@w3.org>
Message-ID: <NDBBIMACDKCOPBLEJCCDMEILCKAA.gregor.karlinger@iaik.at>
Hi all,

Having read the XPath Rec, I found the following paragraph in
section 2.3 about node tests:

  "A QName in the node test is expanded into an expanded-name using the
namespace
  declarations from the expression context. This is the same way expansion
is done
  for element type names in start and end-tags except that the default
namespace
  declared with xmlns is not used: if the QName does not have a prefix, then
the
  namespace URI is null (this is the same way attribute names are expanded).
It
  is an error if the QName has a prefix for which there is no namespace
  declaration in the expression context."

Does this really mean, that I cannot select a node which has a default
namespace
declared? Consider the following example:

<NS1:DocElement xmlns="http://anywhere.com/default"
xmlns:NS1="http://anywhere.com/ns1">
  <NS1:FirstChild/>
  <SecondChild/>
</NS1:DocElement>

What should the XPath expression "/descendant::SecondChild" provide as
result?

  a) An empty node set, since the expression should select a node with
     an expanded-name constisting of an empty namespace URI and a local part
     equal to "SecondChild"?

  b) A node set consisting of a single element node, since the expression
     should select a node with an expanded-name constisting of the default
     namespace URI ("http://anywhere.com/default") and a local part equal
     to "SecondChild"?

If a) is the answer, we should add a few sentences in the spec, that we
recommend
to introduce a namespace prefix for the XML-Signature elements, and not to
use
the default namespace for them. Otherwhise it would not be possible to
select
such elements with XPath expressions.

Regards, Gregor
---------------------------------------------------------------
Gregor Karlinger
mailto://gregor.karlinger@iaik.at
http://www.iaik.at
Phone +43 316 873 5541
Institute for Applied Information Processing and Communications
Austria
---------------------------------------------------------------
Received on Thursday, 7 September 2000 07:38:28 GMT

This archive was generated by hypermail 2.2.0 + w3c-0.29 : Thursday, 13 January 2005 12:10:11 GMT