Re: [xml] XPath with default namespace
- From: Wai-Sun Chia <waisun chia compaq com>
- To: veillard redhat com
- Cc: xml <xml gnome org>
- Subject: Re: [xml] XPath with default namespace
- Date: Fri, 20 Jul 2001 01:15:49 +0800
Daniel Veillard wrote:
xmlXPathRegisterNs(xpathCtxt, "svg", "http://www.w3.org/Graphics/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
xmlXPathRegisterNs()?
Hardcoding of the namespace "svg" and the URI
"http://www.w3.org/Graphics/SVG" 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]