Raul,
thanks.

However, the element that I create is a top level
elemen, i.e. an apex node (as far as I understand the
c14n specs). According to the WSS specs

<cite>
* Finally, employ the canonicalization method specified as a parameter to the 
transform to 
serialize N to produce the octet stream output of this transform; but, in place of any
dereferenced <wsse:SecurityTokenReference> element Ri and its descendants,
process the dereferenced node set Ri' instead. During this step, canonicalization of 
the
replacement node set MUST be augmented as follows:
o Note: A namespace declaration xmlns="" MUST be emitted with every apex
element that has no namespace node declaring a value for the default
namespace; cf. XML Decryption Transform.
</cite>

I've tried several things, no success. I explicitly set an empty
default namespace, this is the top level argument (except for the
document node). 

If I use canonicalizeXPathNodeSet(nodeset, incNamespace) would this
work? A very confusing topic.... :-) (And hard to read specs too).

Regards,
Werner

> -----Ursprüngliche Nachricht-----
> Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Gesendet: Donnerstag, 27. Mai 2004 15:29
> An: [EMAIL PROTECTED]
> Betreff: Re: Question on c14n exclusive
> 
> 
> > All,
> >
> > a question to the c14 gurus on the list.
> >
> > I set up an Element node and set the default namespace
> > to "" using the following code:
> >
> >    elem.setAttributeNS(WSConstants.XMLNS_NS, "xmlns", "");
> >
> > This seems to work.
> >
> > The element is c14n'ed using the following code:
> >
> >    XMLUtils.circumventBug2650(elem);
> >
> >    /*
> >     * C14n with specified algorithm. According to WSS Specification.
> >     * c14n algo is: c14n ExclOmitComments
> >     */
> >     buf = canon.canonicalizeSubtree(doc, "#default");
> >
> > After this the xmlns="" is gone, at least when I convert the
> > buf to String and print it I don't see a xmlns="" at the
> > elements.
> >
> > What is wrong with the above?
> >
> >
> > Regards,
> > Werner
> >
> 
> First, what version of xml-sec are you using? If you are 
> using the CVS you
> don't need the circumventBug2650 for subtree c14n.
> Anyway, In the exclusive the inclusive namespaces are treated like it
> would be in the inclusive and in the inclusive spec the rule 
> for writting
> xmlns="" is:
> <cite>
>     * the element E that owns the axis is in the node-set
>     * The nearest ancestor element of E in the node-set has a default
> namespace node in the node-set (default namespace nodes always have
> non-empty values in XPath)
> The latter condition eliminates unnecessary occurrences of 
> xmlns="" in the
> canonical form since an element *only receives* an xmlns="" *if its
> default namespace is empty and if it has an immediate *parent* in the
> canonical form that has a *non-empty* default namespace*. To finish
> processing L, simply process every namespace node in L, except omit
> namespace node with local name xml, which defines the xml 
> prefix, if its
> string value is http://www.w3.org/XML/1998/namespace.
> </cite>
> 
> So the xmlns="" will be removed if there is no other 
> xmlns="X" definition
> previously.
> 

Reply via email to