Re: [xml] XPath problem

Daniel Veillard <veillard redhat com> writes:

On Thu, Mar 25, 2004 at 11:16:21PM +0100, Marek Elsner wrote:
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>


marek is in a namespace. The "//marek" XPath expression won't select
it. The XPath spec is at
this issue is an XPath FAQ, it's just that lixml2 implements the spec !



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"].


Attachment: pgpmFepjV4Whe.pgp
Description: PGP signature

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]