* Fixed: [namespace prefix nc is not supported in full #154](https://github.com/clicon/clixon/issues/154)
* edit-config "config" parameter did not work with prefix other than null
This commit is contained in:
parent
2b9f19a19f
commit
d045e8abce
6 changed files with 85 additions and 17 deletions
|
|
@ -35,26 +35,24 @@
|
|||
* Clixon XML XPATH 1.0 according to https://www.w3.org/TR/xpath-10
|
||||
*
|
||||
* Some notes on namespace extensions in Netconf/Yang
|
||||
* RFC6241 8.9.1
|
||||
* The set of namespace declarations are those in scope on the <filter> element.
|
||||
* 1) The xpath is not "namespace-aware" in the sense that if you look for a path, eg
|
||||
* "n:a/n:b", those must match the XML, so they need to match prefixes AND name in the xml
|
||||
* such as <n:a><n:b>. An xml with <m:a><m:b> (or <a><b>) will NOT match EVEN IF they have the
|
||||
* same namespace given by xmlns settings.
|
||||
* 2) RFC6241 8.9.1
|
||||
* In the scope of get-.config, the set of namespace declarations are those in scope on the
|
||||
* <filter> element.
|
||||
* <rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
|
||||
* <get-config>
|
||||
* <filter xmlns:t="http://example.com/schema/1.2/config"
|
||||
* type="xpath"
|
||||
* select="/t:top/t:users/t:user[t:name='fred']"/>
|
||||
* </get-config>
|
||||
* We need to add namespace context to the cpath tree, typically in eval. How do
|
||||
* we do that?
|
||||
* One observation is that the namespace context is static, so it can not be a part
|
||||
* of the xpath-tree, which is context-dependent.
|
||||
* Best is to send it as a (read-only) parameter to the xp_eval family of functions
|
||||
* as an exlicit namespace context.
|
||||
* For that you need an API to get/set namespaces: clixon_xml_nscache.c?
|
||||
* Then you need to fix API functions and this is the real work:
|
||||
* - Replace all existing functions or create new?
|
||||
* - Expose explicit namespace parameter, or xml object, or default namespace?
|
||||
*
|
||||
* @see README.md#xml-and-xpath for description of xpath implementation
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "clixon_config.h" /* generated by config & autoconf */
|
||||
|
|
@ -587,7 +585,9 @@ xpath_vec_ctx(cxobj *xcur,
|
|||
*
|
||||
* @code
|
||||
* cxobj *x;
|
||||
* cvec *nsc; // namespace context
|
||||
* cvec *nsc = NULL; // namespace context
|
||||
* if (xml_nsctx_node(xtop, &nsc) < 0)
|
||||
* err;
|
||||
* if ((x = xpath_first(xtop, nsc, "//symbol/foo")) != NULL) {
|
||||
* ...
|
||||
* }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue