Re: [xml] XPath with default namespace

Daniel Veillard wrote:

   xmlXPathRegisterNs(xpathCtxt, "svg", "";);

and query for //svg:desc (check the real URI for SVG Namespace, I invented it).
The good point is that this will work whether the given namespace is
the default one, or mapped to any other prefix. The XPath engine will do
the matching on the URI resolved using the prefix declared in the XPath
context and will ignore the actual prefix used in the instance.

But how do I dynamically get the URI out from the doc, so that I can put it in


Hardcoding of the namespace "svg" and the URI ""; is not a very good idea for generic components...

Wai-Sun "Squidster" Chia
Unix/Web Developer/RHCE
Professional Services

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