Re: [xml] Namespace in XPath
- From: Daniel Veillard <veillard redhat com>
- To: "Sze, Tak F" <tak f sze intel com>
- Cc: xml gnome org
- Subject: Re: [xml] Namespace in XPath
- Date: Wed, 16 May 2001 03:03:57 -0400
On Tue, May 15, 2001 at 02:42:32PM -0700, Sze, Tak F wrote:
I tried using namespace in XPath, and it does not seem to work:
<doc xmlns:test="http://test.com">
<test:element>test</test:element>
</doc>
XPath used is "/doc/test:element"
Is there another interface to pass the namespace URI mapping
for the prefix used in the XPath expression?
Use xmlXPathRegisterNs () to register the namespace within
the evaluation context.
http://xmlsoft.org/html/libxml-xpathinternals.html#XMLXPATHREGISTERNS
Or use the local-name() and namespace-uri() functions of XPath
http://www.w3.org/TR/xpath#function-local-name
/*[local-name()='element' and namespace-uri()='http://test.com']
Daniel
--
Daniel Veillard | Red Hat Network http://redhat.com/products/network/
veillard redhat com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]