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

RE: XPath question

From: John Boyer <jboyer@PureEdge.com>
Date: Thu, 7 Sep 2000 10:25:58 -0700
To: "Gregor Karlinger" <gregor.karlinger@iaik.at>, "XMLSigWG" <w3c-ietf-xmldsig@w3.org>
Message-ID: <BFEDKCINEPLBDLODCODKMEOCCEAA.jboyer@PureEdge.com>
Hi Gregor,

Actually, it doesn't mean that you can't match elements that are in the
default namespace.  For an example, see [1]

http://www.w3.org/TR/xmldsig-core/#sec-XPath

In the first code example, the Signature is in the default namespace of
&dsig;.  However, the XPath expression has the dsig prefix declared, and the
match to the Signature is done using dsig:Signature.  Thus, matching
elements in the default namespace can be done by setting up a prefix with
the same URI as the default namespace.

Incidentally, if [1] resolves to a draft that mentions the subexpression
(//. | //@* | //namespace::*), note that you no longer need this
subexpression as a result of the change of processing model.

Thanks,
John Boyer
Development Team Leader,
Distributed Processing and XML
PureEdge Solutions Inc.
Creating Binding E-Commerce
v: 250-479-8334, ext. 143  f: 250-479-3772
1-888-517-2675   http://www.PureEdge.com <http://www.pureedge.com/>



-----Original Message-----
From: w3c-ietf-xmldsig-request@w3.org
[mailto:w3c-ietf-xmldsig-request@w3.org]On Behalf Of Gregor Karlinger
Sent: Thursday, September 07, 2000 4:39 AM
To: XMLSigWG
Subject: XPath question


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 13:26:08 GMT

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