Re: [xml] SelectSingleNode



On Mon, May 02, 2011 at 03:47:04PM -0400, Paul B. Cameron wrote:
In this particular case, however, I know how to format and register the
namespace information before evaluating the query. The challenge is
obtaining the set of namespaces declared by the instance document in the
first place.

  Unfortunately the Microsoft API doesn't make much sense I'm afraid
(or I misunderstand it), because a namespace URI may be bound to
multiple prefixes on a document, and a given prefix may be bound to
different namespace on a given document. So asking at the document
level doesn't make sense to me.
  What you can do is ask for the list of namespaces in scope for
a given element, libxml2 has an aPI for this:
  http://xmlsoft.org/html/libxml-tree.html#xmlGetNsList

  Note that the namespace prefix used in an XPath query is not significant,
the XPath matching will be done only on th namespace name, never the prefix.

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



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