Re: [xml] XPath problem
- From: Daniel Veillard <veillard redhat com>
- To: Marek Elsner <marek icom pl>
- Cc: Petr Pajas <pajas ufal ms mff cuni cz>, xml gnome org
- Subject: Re: [xml] XPath problem
- Date: Fri, 26 Mar 2004 09:21:38 -0500
On Fri, Mar 26, 2004 at 10:56:00AM +0100, Petr Pajas wrote:
Daniel Veillard <veillard redhat com> writes:
On Thu, Mar 25, 2004 at 11:16:21PM +0100, Marek Elsner wrote:
Hello,
I have got problem with XPath.
When following program is run "./program hello.xml, ( hello.xml is under
source code of program)
it doesn't show node <marek>
[...]
xmlns="urn:iana:xml:ns:epp-1.0"
marek is in a namespace. The "//marek" XPath expression won't select
it. The XPath spec is at http://www.w3.org/TR/xpath
this issue is an XPath FAQ, it's just that lixml2 implements the spec !
Daniel
Marek,
although this as been asked and answered zillion times on this list,
I'd just add to Daniel, that you may still programmatically register a
namespace prefix for "urn:iana:xml:ns:epp-1.0" (say "foo") with the
xpath context, using something like
xmlXPathRegisterNs(context, "foo", "urn:iana:xml:ns:epp-1.0");
and then use it in your queries as "//foo:marek".
It's much shorter that writing the pure XPath like
//*[local-name()="marek" and namespace-uri()="urn:iana:xml:ns:epp-1.0"].
Right and see xpath1.c full example
http://xmlsoft.org/examples/index.html#XPath
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
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]