You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by Lionel PASQUIER <lp...@omnikles.com> on 2003/05/30 16:04:04 UTC
selecting Signature tag of whichever namespace?
Hi there,
Newbie, I would like to select any tag Signature or *:Signature.
That is, selecting any Signature tag, whichever namespace the tag depends from.
How should I do this?
I had a few idea such as:
NodeList signatureElems = XPathAPI.selectNodeList(doc,"//Signature");
if(signatureElems.getLength() < 1)
signatureElems = XPathAPI.selectNodeList(doc,"//*:Signature"); //I guess this will not do, don't you think?
or like this:
getElementsByTagName("Signature"); //will this work?
Is there a way to create a context Element matching ANY namespace?
something like:
signatureElems = XPathAPI.selectNodeList(doc,"//Signature", matchingAnyNamespaceContext);
Thank you by adavance, and my apologies if the question is irrelevant.
Lionel
Re: selecting Signature tag of whichever namespace?
Posted by Caroline Foster <ca...@runbox.com>.
Lionel,
Forgive me if I'm mistaken, but I think you will always be wanting only
Signature elements from the XML Signature namespace in a real application.
What I think you want to do is to be able to select Signature elements with
any prefix.
The namespace is defined by the W3C and is
http://www.w3.org/2000/07/xmldsig#, all signature prefixes (e.g. ds, dsig)
should be defined to map to this namespace.
I suggest you set up a sample file containing a number of signatures
declared with different prefixes but all mapped to the XML Signature
namespace and then try out your ideas below and see what you get back.
Sorry I couldn't be more help,
Caroline.
On Fri, 30 May 2003 16:04:04 +0200, Lionel PASQUIER
<lp...@omnikles.com> wrote:
> Hi there,
>
> Newbie, I would like to select any tag Signature or *:Signature.
> That is, selecting any Signature tag, whichever namespace the tag depends
> from.
>
> How should I do this?
>
> I had a few idea such as:
> NodeList signatureElems = XPathAPI.selectNodeList(doc,"//Signature");
> if(signatureElems.getLength() < 1)
> signatureElems = XPathAPI.selectNodeList(doc,"//*:Signature"); //I guess
> this will not do, don't you think?
>
> or like this:
> getElementsByTagName("Signature"); //will this work?
>
> Is there a way to create a context Element matching ANY namespace?
> something like:
> signatureElems = XPathAPI.selectNodeList(doc,"//Signature",
> matchingAnyNamespaceContext);
>
> Thank you by adavance, and my apologies if the question is irrelevant.
>
> Lionel
>
>