This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XPATH and namespaces

JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Given the following XML doc
then xpath.selectSingleNode(theNode,"/AAA/BBB") returns the node BBB.

If the doc uses a default namespace, then I have to prefix the node name with an empty Namespace
e.g : xpath.selectSingleNode(theNode,"/:AAA/:BBB")

And in a namescape with a prefix like :


my XPATH now needs to be like :

Is there a way to define the namespace xpath will use to resolve outside of the XPATH string.
I would like to be able to use :
xpath.selectSingleNode(theNode,"/AAA/BBB") no matter the prefix used in my XML doc.
I've tried to figure out how the PrefixResolver works..... but I failed :-(

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic