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"]. /Petr
Attachment:
pgp2jtjsHm8O2.pgp
Description: PGP signature