XPath isn retrieving nodes that are in the default namespace I defined. How do I get them?
If you are looking for nodes in a namespace, the XPath expression must include a namespace prefix that you have mapped to the namespace with an xmlns declaration. If you have declared a default namespace, it does not have a prefix (see XPath Node Tests). In order to construct XPath expressions to retrieve nodes from this namespace, you must add a namespace declaration that provides a prefix you can include in the XPath expressions. Suppose, for example, you you want to locate nodes in a default namespace declared as follows: xmlns=”http://my-namespace” Add a nampespace declaration with a prefix: xmlns:foo=”http://my-namespace” Then you can use foo: in your XPath expression. Hint: Don’t use default namespaces, and the problem doesn’t arise.