Re: [xml] Re: [xmlsec] exc c14n w/o comments bug

  However when you ask for namespace from an XPath query, then
libxml2 XPath engine will return different namespace element, because in
the XPath model, you don't see namespace declarations, but in scope
namespaces and to mimic those (and the fact that the parent of an in-scope namespace on an element is the element and not the element declaring
it), the XPath engine need to create namespaces on-the fly.
Yes, this is exactly the problem :) I am sorry I gave slightly wrong
example in my previous message. The better one is the following
(I am using a modified example xpath2.c):

$ cat test.xml
<test1:Root xmlns:test1="";
        <test2:Something test1:attr="value"/>

$ xpath1 test.xml \
 "(//. | //@* | //namespace::*)[ancestor-or-self::test2:Something]" \
 "test1= test2=";

Result (5 nodes): = element node ptr=00349E50 (ns-ptr=00349B20) ""; = attribute node ptr=00349F10 (ns-ptr=00349A28) ""; = namespace ptr=0034AE28 (node-ptr=00349E50)
  "xml"=""; for
= namespace ptr=0034ADC0 (node-ptr=00349E50)
  "test2"=""; for
= namespace ptr=0034ABA0 (node-ptr=00349E50)
  "test1"=""; for

As you can see, that attribute node points to namespace object 00349A28
which is different from namespace declaration object 0034AE28.

The problem is that during exc-c14n I have to check if particular
namespace is visible or not. This works just great for element
namespaces but for attributes it fails because of the reasons described

  Hum, this is a bit unclear to me. I can't comment on this.
Sorry, the long description is basically repeating the spec:
the particular namespace declaration node is rendered in exc-c14n output
if and only if the following conditions are true:
  1) The namespace declaration node is "visible" (i.e. it is
   in the XPath nodeset).
  2) The namespace is "visibly utilized" (i.e. it is used by the
  a "visible" attribute of this node or the node itself).
  3) The namespace declaration node with the same prefix and URI was
  not rendered in the ancestor of this node.

The problem caused by the fact that "visible" namespace declaration
node is different from the "visibly utilized" one.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]