Read again :)

I can't see an ugly XPath with all that local-name() stuff.

In your case it would be:

xPath = "//*[local-name()=ParentPrescription]"
  + "/*[local-name()=pertinentInformation1]"
  + "/*[local-name()=pertinentPrescription]"
  + "/*[local-name()=author]"
  + "/*[local-name()=signatureText]"
  + "/*[local-name()=Signature]";

HTH,

Heiner

P.S.: That's how I generated most of it in a u*ix shell:
echo ParentPrescription/pertinentInformation1/pertinentPrescription\
/author/signatureText/Signature | \
awk '\
  BEGIN { RS="/" } \
  { printf "\n  + \"/*[local-name()=%c%s%c]\"",39,$1,39} \
  END { printf ";\n"}'

[EMAIL PROTECTED] wrote:
javax.xml.parsers.DocumentBuilderFactory dbf =
       javax.xml.parsers.DocumentBuilderFactory.newInstance();

dbf.setNamespaceAware(true);
javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
Document signedDoc = db.parse(new
java.io.ByteArrayInputStream(signedStr.getBytes()));


sigElement  =
(Element)XPathAPI.selectSingleNode(signedDoc,"//ParentPrescription/pertinentI
nformation1/pertinentPrescription/author/signatureText/Signature");

System.out.println(sigElement.getNodeName());


throws the following exception, which means it cannot evaluate the xpath


java.lang.NullPointerException at com.syntegra.xml.dsig.sign.XMLDSig.verify(XMLDSig.java:178) at com.syntegra.xml.dsig.sign.XMLDSig.main(XMLDSig.java:78)



Which means Heiner, its not working....


Best Always,
............................................................................
Ritesh Aswaney
* Mobile: +44 7909540132
............................................................................


-----Original Message-----
From: Heiner Westphal [mailto:[EMAIL PROTECTED] Sent: 09 March 2005 19:54
To: security-dev@xml.apache.org
Subject: Re: Somone... help... please ...


Ritesh,

leaving the namepaceAware on true and use some ugly XPath like
"//*[local-name()='Header']/*[local-name()='SenderInfo']/*[local-name()='Send
erID']"
will match the node you would have called
"//Header/SenderInfo/SenderID" in absence of namespaces.

Sadly it matches nodes even in the wrong namespace, but that is usualy not a problem, because its not common to mix the same element names from different namespaces.

Dont know if it works in your case, but I would give it a try.

Regards,

Heiner




********************************************************************

This email may contain information which is privileged or confidential. If you 
are not the intended recipient of this email, please notify the sender 
immediately and delete it without reading, copying, storing, forwarding or 
disclosing its contents to any other person
Thank you

Check us out at http://www.bt.com/consulting

********************************************************************




Reply via email to