Could you please provide me sample code of how I would do this.  It's not
very clear to me from this email what to do.  I tried using
PrefixResolverDefault, but don't know exactly what to do with it.  I tried
creating the elements using createElementNS, but that didn't work either.  I
would really appreciate it if you could guide me how I can do what's said in
the email below.

Thank you very much for taking the time.
Malia

-----Original Message-----
From: Joseph Kesselman/Watson/IBM [mailto:[EMAIL PROTECTED]
Sent: Monday, May 20, 2002 5:06 PM
To: Malia Zaheer <mzaheer
Cc: xalan-j-users
Subject: Re: can't retrieve node with prefix



To retrieve  a node that has been place in a namespace, you _must_ specify
the same namespace in your XPath. You do that by using a prefix in the
XPath string, and by providing a prefix resolution context which maps that
prefix into the same namespace URI that was used in the document. In the
simple version of the XPathAPI call you're using, the parent node will be
used as the prefix resolver context; any namespace prefixes declared on or
above that parent node should be picked up and used. If you need to
reference namespaces which aren't defined at that level, you'll have to use
one of the fancier versions of the XPathAPI:
      selectSingleNode(contextNode,string,namspaceNode)
Here, the namespaceNode may be any DOM node, so if you don't already have a
node handy which has all the proper namespace context you can fall back on
hand-generating a DOM node which does.

Lower-level calls such as XPathAPI.eval() allow you to plug in hand-coded
prefix-to-namespace resolvers, if that ever becomes necessary..

______________________________________
Joe Kesselman  / IBM Research

Reply via email to