Re: [xml] xpathEval and namespaces
- From: Martijn Faassen <faassen infrae com>
- To: veillard redhat com
- Cc: xml gnome org
- Subject: Re: [xml] xpathEval and namespaces
- Date: Tue, 14 Sep 2004 16:31:15 +0200
Daniel Veillard wrote:
On Tue, Sep 14, 2004 at 12:47:43PM +0200, Jos Vos wrote:
With this even docroot.xpathEval('/head') gives an empty nodeset back
(docroot is my root node object), while it works fine when I remove
the namespace attributes.
that's normal /foo does not select namespaced nodes, it's the XPath spec.
It's probably #1 FAQ for XPath. As explained dozens of time you must
bin a prefix to that namespace in the XPath context and use the prefix in
the query. I don't remember if/how it's doable from Python.
context = dom.xpathNewContext()
Now Daniel has time to look into my namespace-related bug report. :)
] [Thread Prev