Ok, You must put always namespaceAware(true), for fixing your xpath problems is recommended to do something like that:
Element nscontext = XMLUtils.createDSctx(doc, "ds", Constants.SignatureSpecNS); //retrieve the signature Element from the document Element sigElement = (Element) XPathAPI.selectSingleNode(doc, "//ds:Signature[1]", nscontext); Please note how it creates a node and see how it binds to a URI, and then how it does the search. I think this will fix your problems. This example was taken from the samples in the xml-sec, but it is also described in the xalan faq. Regards, Raul On Wed, 9 Mar 2005 19:36:14 -0000, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > Hello All, > > > > (Raul, Berin, someone listen to me â) > > > > I have managed to generated the XML DSig and embed it into the required > document at the location desired > > (There is a requirement for the dsig element to be present at a fixed > location in the document) > > > > Now when I try to verify the signature, obviously I have to select the > element using xpath > > If the DocumentBuilderFactory object is set to namespaceAware(true), the > xpath just wont evaluate, coz of namespace problems > > (I ve tried a lot of things from my limited knowledge, but it just wont > evaluate) > > > > It evaluates when the namespaceAware(false) , but then it throws this error > > > > org.apache.xml.security.exceptions.XMLSecurityException: Cannot create a > null:null from a http://www.w3.org/2000/09/xmldsig#:Signature element > > > > What is the way out? > > > > I have this code due for delivery like real soon, can someone please take > time out and lemme know how to get it to work ? > > I ve completely run out of ideasssssss > > > > Best Always, > ........................................................................................................................ > > Ritesh Aswaney > ( Mobile: +44 7909540132 > > ......................................................................................................................... > > > > ******************************************************************** > > 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 > > ******************************************************************** > -- http://r-bg.com