printer & parser json BUGFIX anyxml node

Anyxml was processed exactly as anydata,
which is completely wrong and is more
similar to leaf.
Refs #1762
diff --git a/src/parser_json.c b/src/parser_json.c
index 146b37a..355b544 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -20,6 +20,7 @@
 #include <string.h>
 
 #include "common.h"
+#include "compat.h"
 #include "context.h"
 #include "dict.h"
 #include "in_internal.h"
@@ -1160,14 +1161,17 @@
         enum LYJSON_PARSER_STATUS *status, struct lyd_node **node)
 {
     LY_ERR ret;
-    uint32_t type_hints = 0;
-    uint32_t prev_parse_opts, prev_int_opts;
+    uint32_t type_hints = 0, prev_parse_opts, prev_int_opts;
+    char *val;
     struct lyd_node *tree = NULL;
 
     ret = lydjson_data_check_opaq(lydctx, snode, &type_hints);
     if (ret == LY_SUCCESS) {
         assert(snode->nodetype & (LYD_NODE_TERM | LYD_NODE_INNER | LYD_NODE_ANY));
         if (snode->nodetype & LYD_NODE_TERM) {
+            LY_CHECK_RET((*status != LYJSON_ARRAY) && (*status != LYJSON_NUMBER) && (*status != LYJSON_STRING) &&
+                    (*status != LYJSON_FALSE) && (*status != LYJSON_TRUE) && (*status != LYJSON_NULL), LY_EINVAL);
+
             /* create terminal node */
             ret = lyd_parser_create_term((struct lyd_ctx *)lydctx, snode, lydctx->jsonctx->value,
                     lydctx->jsonctx->value_len, &lydctx->jsonctx->dynamic, LY_VALUE_JSON, NULL,
@@ -1183,9 +1187,32 @@
                 assert(*status == LYJSON_ARRAY_CLOSED);
             }
             LY_CHECK_RET(lyjson_ctx_next(lydctx->jsonctx, status));
+        } else if (snode->nodetype == LYS_ANYXML) {
+            LY_CHECK_RET((*status != LYJSON_STRING) && (*status != LYJSON_NULL), LY_EINVAL);
+
+            /* create anyxml node */
+            if (*status == LYJSON_NULL) {
+                ret = lyd_create_any(snode, NULL, LYD_ANYDATA_STRING, 1, node);
+                LY_CHECK_RET(ret);
+            } else if (lydctx->jsonctx->dynamic) {
+                ret = lyd_create_any(snode, lydctx->jsonctx->value, LYD_ANYDATA_STRING, 1, node);
+                LY_CHECK_RET(ret);
+                lydctx->jsonctx->dynamic = 0;
+            } else {
+                val = strndup(lydctx->jsonctx->value, lydctx->jsonctx->value_len);
+                LY_CHECK_ERR_RET(!val, LOGMEM(lydctx->jsonctx->ctx), LY_EMEM);
+                ret = lyd_create_any(snode, val, LYD_ANYDATA_STRING, 1, node);
+                if (ret) {
+                    free(val);
+                    return ret;
+                }
+            }
+
+            /* move JSON parser */
+            LY_CHECK_RET(lyjson_ctx_next(lydctx->jsonctx, status));
         } else if (snode->nodetype & LYD_NODE_INNER) {
             /* create inner node */
-            LY_CHECK_RET(*status != LYJSON_OBJECT && *status != LYJSON_OBJECT_EMPTY, LY_EINVAL);
+            LY_CHECK_RET((*status != LYJSON_OBJECT) && (*status != LYJSON_OBJECT_EMPTY), LY_EINVAL);
 
             ret = lyd_create_inner(snode, node);
             LY_CHECK_RET(ret);
@@ -1193,7 +1220,7 @@
             LOG_LOCSET(snode, *node, NULL, NULL);
 
             /* process children */
-            while (*status != LYJSON_OBJECT_CLOSED && *status != LYJSON_OBJECT_EMPTY) {
+            while ((*status != LYJSON_OBJECT_CLOSED) && (*status != LYJSON_OBJECT_EMPTY)) {
                 ret = lydjson_subtree_r(lydctx, *node, lyd_node_child_p(*node), NULL);
                 LY_CHECK_ERR_RET(ret, LOG_LOCBACK(1, 1, 0, 0), ret);
                 *status = lyjson_ctx_status(lydctx->jsonctx, 0);
@@ -1225,9 +1252,9 @@
             /* move JSON parser */
             ret = lyjson_ctx_next(lydctx->jsonctx, status);
             LY_CHECK_RET(ret);
-        } else if (snode->nodetype & LYD_NODE_ANY) {
+        } else if (snode->nodetype == LYS_ANYDATA) {
             /* create any node */
-            LY_CHECK_RET(*status != LYJSON_OBJECT && *status != LYJSON_OBJECT_EMPTY, LY_EINVAL);
+            LY_CHECK_RET((*status != LYJSON_OBJECT) && (*status != LYJSON_OBJECT_EMPTY), LY_EINVAL);
 
             /* parse any data tree with correct options */
             /* first backup the current options and then make the parser to process data as opaq nodes */
@@ -1238,7 +1265,7 @@
             lydctx->int_opts |= LYD_INTOPT_ANY | LYD_INTOPT_WITH_SIBLINGS;
 
             /* process the anydata content */
-            while (*status != LYJSON_OBJECT_CLOSED && *status != LYJSON_OBJECT_EMPTY) {
+            while ((*status != LYJSON_OBJECT_CLOSED) && (*status != LYJSON_OBJECT_EMPTY)) {
                 ret = lydjson_subtree_r(lydctx, NULL, &tree, NULL);
                 LY_CHECK_RET(ret);
                 *status = lyjson_ctx_status(lydctx->jsonctx, 0);
@@ -1402,7 +1429,7 @@
         case LYS_RPC:
         case LYS_ANYDATA:
         case LYS_ANYXML:
-            if (snode->nodetype == LYS_LEAF) {
+            if (snode->nodetype & (LYS_LEAF | LYS_ANYXML)) {
                 if (status == LYJSON_ARRAY) {
                     expected = "name/[null]";
                 } else {
diff --git a/src/printer_json.c b/src/printer_json.c
index 6b2ee02..7c251a1 100644
--- a/src/printer_json.c
+++ b/src/printer_json.c
@@ -518,21 +518,27 @@
 }
 
 /**
- * @brief Print anydata data node including its metadata.
+ * @brief Print anydata/anyxml content.
  *
  * @param[in] ctx JSON printer context.
  * @param[in] any Anydata node to print.
  * @return LY_ERR value.
  */
 static LY_ERR
-json_print_anydata(struct jsonpr_ctx *ctx, struct lyd_node_any *any)
+json_print_any_content(struct jsonpr_ctx *ctx, struct lyd_node_any *any)
 {
     LY_ERR ret = LY_SUCCESS;
     struct lyd_node *iter;
     uint32_t prev_opts, prev_lo;
 
+    /* anyxml - printed as name/value pair;
+     * anydata - printed as an object */
+
     if (!any->value.tree) {
         /* no content */
+        if (any->schema->nodetype == LYS_ANYXML) {
+            ly_print_(ctx->out, "null");
+        }
         return LY_SUCCESS;
     }
 
@@ -556,6 +562,11 @@
 
     switch (any->value_type) {
     case LYD_ANYDATA_DATATREE:
+        if (any->schema->nodetype == LYS_ANYXML) {
+            /* print always as a string */
+            ly_print_(ctx->out, "\"%s", DO_FORMAT ? "\n" : "");
+        }
+
         /* close opening tag and print data */
         prev_opts = ctx->options;
         ctx->options &= ~LYD_PRINT_WITHSIBLINGS;
@@ -566,28 +577,42 @@
         }
 
         ctx->options = prev_opts;
+
+        if (any->schema->nodetype == LYS_ANYXML) {
+            /* terminate the string */
+            ly_print_(ctx->out, "\"");
+        }
         break;
     case LYD_ANYDATA_JSON:
         /* print without escaping special characters */
-        if (!any->value.str[0]) {
-            return LY_SUCCESS;
+        if (any->schema->nodetype == LYS_ANYXML) {
+            /* print as a string */
+            ly_print_(ctx->out, "\"%s\"", any->value.str);
+        } else if (any->value.str[0]) {
+            /* print with indent */
+            ly_print_(ctx->out, "%*s%s", INDENT, any->value.str);
         }
-        ly_print_(ctx->out, "%*s%s", INDENT, any->value.str);
         break;
     case LYD_ANYDATA_STRING:
     case LYD_ANYDATA_XML:
+        if (any->schema->nodetype == LYS_ANYXML) {
+            /* print as a string */
+            ly_print_(ctx->out, "\"%s\"", any->value.str);
+            break;
+        }
+    /* fallthrough */
     case LYD_ANYDATA_LYB:
         /* JSON and LYB format is not supported */
         LOGWRN(ctx->ctx, "Unable to print anydata content (type %d) as XML.", any->value_type);
-        return LY_SUCCESS;
+        break;
     }
 
     return LY_SUCCESS;
 }
 
 /**
- * @brief Print content of a single container/list data node including its metadata.
- * The envelope specific to container and list are expected to be printed by the caller.
+ * @brief Print content of a single container/list/anydata data node including its metadata.
+ * The envelope specific to nodes are expected to be printed by the caller.
  *
  * @param[in] ctx JSON printer context.
  * @param[in] node Data node to print.
@@ -629,7 +654,7 @@
         }
     } else {
         /* anydata */
-        json_print_anydata(ctx, (struct lyd_node_any *)node);
+        json_print_any_content(ctx, (struct lyd_node_any *)node);
     }
 
     LEVEL_DEC;
@@ -660,6 +685,26 @@
 }
 
 /**
+ * @brief Print anyxml data node including its metadata.
+ *
+ * @param[in] ctx JSON printer context.
+ * @param[in] node Data node to print.
+ * @return LY_ERR value.
+ */
+static int
+json_print_anyxml(struct jsonpr_ctx *ctx, const struct lyd_node *node)
+{
+    LY_CHECK_RET(json_print_member(ctx, node, 0));
+    LY_CHECK_RET(json_print_any_content(ctx, (struct lyd_node_any *)node));
+    LEVEL_PRINTED;
+
+    /* print attributes as sibling */
+    json_print_attributes(ctx, node, 0);
+
+    return LY_SUCCESS;
+}
+
+/**
  * @brief Check whether a node is the last printed instance of a (leaf-)list.
  *
  * @param[in] ctx JSON printer context.
@@ -867,6 +912,7 @@
         case LYS_RPC:
         case LYS_ACTION:
         case LYS_NOTIF:
+        case LYS_ANYDATA:
         case LYS_CONTAINER:
             LY_CHECK_RET(json_print_container(ctx, node));
             break;
@@ -878,8 +924,7 @@
             LY_CHECK_RET(json_print_leaf_list(ctx, node));
             break;
         case LYS_ANYXML:
-        case LYS_ANYDATA:
-            LY_CHECK_RET(json_print_container(ctx, node));
+            LY_CHECK_RET(json_print_anyxml(ctx, node));
             break;
         default:
             LOGINT(node->schema->module->ctx);
diff --git a/tests/modules/yang/ietf-netconf-nmda@2019-01-07.yang b/tests/modules/yang/ietf-netconf-nmda@2019-01-07.yang
new file mode 100644
index 0000000..31dce50
--- /dev/null
+++ b/tests/modules/yang/ietf-netconf-nmda@2019-01-07.yang
@@ -0,0 +1,385 @@
+   module ietf-netconf-nmda {
+     yang-version 1.1;
+     namespace "urn:ietf:params:xml:ns:yang:ietf-netconf-nmda";
+     prefix ncds;
+
+     import ietf-yang-types {
+       prefix yang;
+       reference
+         "RFC 6991: Common YANG Data Types";
+     }
+     import ietf-inet-types {
+       prefix inet;
+       reference
+         "RFC 6991: Common YANG Data Types";
+     }
+     import ietf-datastores {
+       prefix ds;
+       reference
+         "RFC 8342: Network Management Datastore Architecture
+                    (NMDA)";
+     }
+     import ietf-origin {
+       prefix or;
+       reference
+         "RFC 8342: Network Management Datastore Architecture
+                    (NMDA)";
+     }
+     import ietf-netconf {
+       prefix nc;
+       reference
+         "RFC 6241: Network Configuration Protocol (NETCONF)";
+     }
+     import ietf-netconf-with-defaults {
+       prefix ncwd;
+       reference
+         "RFC 6243: With-defaults Capability for NETCONF";
+     }
+
+     organization
+       "IETF NETCONF Working Group";
+
+     contact
+       "WG Web:   <https://datatracker.ietf.org/wg/netconf/>
+
+        WG List:  <mailto:netconf@ietf.org>
+
+        Author:   Martin Bjorklund
+                  <mailto:mbj@tail-f.com>
+
+        Author:   Juergen Schoenwaelder
+                  <mailto:j.schoenwaelder@jacobs-university.de>
+
+        Author:   Phil Shafer
+                  <mailto:phil@juniper.net>
+
+        Author:   Kent Watsen
+                  <mailto:kent+ietf@watsen.net>
+
+        Author:   Robert Wilton
+                  <mailto:rwilton@cisco.com>";
+     description
+       "This YANG module defines a set of NETCONF operations to support
+        the Network Management Datastore Architecture (NMDA).
+
+        The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL
+        NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED',
+        'MAY', and 'OPTIONAL' in this document are to be interpreted as
+        described in BCP 14 (RFC 2119) (RFC 8174) when, and only when,
+        they appear in all capitals, as shown here.
+
+        Copyright (c) 2019 IETF Trust and the persons identified as
+        authors of the code.  All rights reserved.
+
+        Redistribution and use in source and binary forms, with or
+        without modification, is permitted pursuant to, and subject to
+        the license terms contained in, the Simplified BSD License set
+        forth in Section 4.c of the IETF Trust's Legal Provisions
+        Relating to IETF Documents
+        (https://trustee.ietf.org/license-info).
+
+        This version of this YANG module is part of RFC 8526; see
+        the RFC itself for full legal notices.";
+
+     revision 2019-01-07 {
+       description
+         "Initial revision.";
+       reference
+         "RFC 8526: NETCONF Extensions to Support the Network Management
+                    Datastore Architecture";
+     }
+
+     feature origin {
+       description
+         "Indicates that the server supports the 'origin' annotation.";
+       reference
+         "RFC 8342: Network Management Datastore Architecture (NMDA)";
+     }
+
+     feature with-defaults {
+       description
+         "NETCONF :with-defaults capability.  If the server advertises
+          the :with-defaults capability for a session, then this
+          feature must also be enabled for that session.  Otherwise,
+          this feature must not be enabled.";
+       reference
+         "RFC 6243: With-defaults Capability for NETCONF, Section 4; and
+          RFC 8526: NETCONF Extensions to Support the Network Management
+                    Datastore Architecture, Section 3.1.1.2";
+     }
+
+     rpc get-data {
+       description
+         "Retrieve data from an NMDA datastore.  The content returned
+          by get-data must satisfy all filters, i.e., the filter
+          criteria are logically ANDed.
+
+          Any ancestor nodes (including list keys) of nodes selected by
+          the filters are included in the response.
+
+          The 'with-origin' parameter is only valid for an operational
+          datastore.  If 'with-origin' is used with an invalid
+          datastore, then the server MUST return an <rpc-error> element
+          with an <error-tag> value of 'invalid-value'.
+
+          The 'with-defaults' parameter only applies to the operational
+          datastore if the NETCONF :with-defaults and
+          :with-operational-defaults capabilities are both advertised.
+          If the 'with-defaults' parameter is present in a request for
+          which it is not supported, then the server MUST return an
+          <rpc-error> element with an <error-tag> value of
+          'invalid-value'.";
+       input {
+         leaf datastore {
+           type ds:datastore-ref;
+           mandatory true;
+           description
+             "Datastore from which to retrieve data.
+
+              If the datastore is not supported by the server, then the
+              server MUST return an <rpc-error> element with an
+              <error-tag> value of 'invalid-value'.";
+         }
+         choice filter-spec {
+           description
+             "The content filter specification for this request.";
+           anydata subtree-filter {
+             description
+               "This parameter identifies the portions of the
+                target datastore to retrieve.";
+             reference
+               "RFC 6241: Network Configuration Protocol (NETCONF),
+                          Section 6";
+           }
+           leaf xpath-filter {
+             if-feature "nc:xpath";
+             type yang:xpath1.0;
+             description
+               "This parameter contains an XPath expression identifying
+                the portions of the target datastore to retrieve.
+
+                If the expression returns a node-set, all nodes in the
+                node-set are selected by the filter.  Otherwise, if the
+                expression does not return a node-set, then the
+                <get-data> operation fails.
+
+                The expression is evaluated in the following XPath
+                context:
+
+                  o  The set of namespace declarations are those in
+                     scope on the 'xpath-filter' leaf element.
+
+                  o  The set of variable bindings is empty.
+
+                  o  The function library is the core function library,
+                     and the XPath functions are defined in Section 10
+                     of RFC 7950.
+
+                  o  The context node is the root node of the target
+                     datastore.";
+           }
+         }
+         leaf config-filter {
+           type boolean;
+           description
+             "Filter for nodes with the given value for their 'config'
+              property.  When this leaf is set to 'true', only 'config
+              true' nodes are selected, and when set to 'false', only
+              'config false' nodes are selected.  If this leaf is not
+              present, no nodes are filtered.";
+         }
+         choice origin-filters {
+           when 'derived-from-or-self(datastore, "ds:operational")';
+           if-feature "origin";
+           description
+             "Filters configuration nodes based on the 'origin'
+              annotation.  Configuration nodes that do not have an
+              'origin' annotation are treated as if they have the
+              'origin' annotation 'or:unknown'.
+
+              System state nodes are not affected by origin-filters and
+              thus not filtered.  Note that system state nodes can be
+              filtered with the 'config-filter' leaf.";
+
+           leaf-list origin-filter {
+             type or:origin-ref;
+             description
+               "Filter based on the 'origin' annotation.  A
+                configuration node matches the filter if its 'origin'
+                annotation is derived from or equal to any of the given
+                filter values.";
+           }
+           leaf-list negated-origin-filter {
+             type or:origin-ref;
+             description
+               "Filter based on the 'origin' annotation.  A
+                configuration node matches the filter if its 'origin'
+                annotation is neither derived from nor equal to any of
+                the given filter values.";
+           }
+         }
+         leaf max-depth {
+           type union {
+             type uint16 {
+               range "1..65535";
+             }
+             type enumeration {
+               enum unbounded {
+                 description
+                   "All descendant nodes are included.";
+               }
+             }
+           }
+           default "unbounded";
+           description
+             "For each node selected by the filters, this parameter
+              selects how many conceptual subtree levels should be
+              returned in the reply.  If the depth is 1, the reply
+              includes just the selected nodes but no children.  If the
+              depth is 'unbounded', all descendant nodes are included.";
+         }
+         leaf with-origin {
+           when 'derived-from-or-self(../datastore, "ds:operational")';
+           if-feature "origin";
+           type empty;
+           description
+             "If this parameter is present, the server will return
+              the 'origin' annotation for the nodes that have one.";
+         }
+         uses ncwd:with-defaults-parameters {
+           if-feature "with-defaults";
+         }
+       }
+       output {
+         anydata data {
+           description
+             "Copy of the source datastore subset that matched
+              the filter criteria (if any).  An empty data
+              container indicates that the request did not
+              produce any results.";
+         }
+       }
+     }
+
+     rpc edit-data {
+       description
+         "Edit data in an NMDA datastore.
+
+          If an error condition occurs such that an error severity
+          <rpc-error> element is generated, the server will stop
+          processing the <edit-data> operation and restore the
+          specified configuration to its complete state at
+          the start of this <edit-data> operation.";
+       input {
+         leaf datastore {
+           type ds:datastore-ref;
+           mandatory true;
+           description
+             "Datastore that is the target of the <edit-data> operation.
+
+              If the target datastore is not writable, or is not
+              supported by the server, then the server MUST return an
+              <rpc-error> element with an <error-tag> value of
+              'invalid-value'.";
+         }
+         leaf default-operation {
+           type enumeration {
+             enum merge {
+               description
+                 "The default operation is merge.";
+             }
+             enum replace {
+               description
+                 "The default operation is replace.";
+             }
+             enum none {
+               description
+                 "There is no default operation.";
+             }
+           }
+           default "merge";
+           description
+             "The default operation to use.";
+         }
+         choice edit-content {
+           mandatory true;
+           description
+             "The content for the edit operation.";
+           anydata config {
+             description
+               "Inline config content.";
+           }
+           leaf url {
+             if-feature "nc:url";
+             type inet:uri;
+             description
+               "URL-based config content.";
+           }
+         }
+       }
+     }
+
+     /*
+      * Augment the <lock> and <unlock> operations with a
+      * "datastore" parameter.
+      */
+
+     augment "/nc:lock/nc:input/nc:target/nc:config-target" {
+       description
+         "Add NMDA datastore as target.";
+       leaf datastore {
+         type ds:datastore-ref;
+         description
+           "Datastore to lock.
+
+            The <lock> operation is only supported on writable
+            datastores.
+
+            If the <lock> operation is not supported by the server on
+            the specified target datastore, then the server MUST return
+            an <rpc-error> element with an <error-tag> value of
+            'invalid-value'.";
+       }
+     }
+
+     augment "/nc:unlock/nc:input/nc:target/nc:config-target" {
+       description
+         "Add NMDA datastore as target.";
+       leaf datastore {
+         type ds:datastore-ref;
+         description
+           "Datastore to unlock.
+
+            The <unlock> operation is only supported on writable
+            datastores.
+
+            If the <unlock> operation is not supported by the server on
+            the specified target datastore, then the server MUST return
+            an <rpc-error> element with an <error-tag> value of
+            'invalid-value'.";
+       }
+     }
+
+     /*
+      * Augment the <validate> operation with a
+      * "datastore" parameter.
+      */
+
+     augment "/nc:validate/nc:input/nc:source/nc:config-source" {
+       description
+         "Add NMDA datastore as source.";
+       leaf datastore {
+         type ds:datastore-ref;
+         description
+           "Datastore to validate.
+
+            The <validate> operation is supported only on configuration
+            datastores.
+
+            If the <validate> operation is not supported by the server
+            on the specified target datastore, then the server MUST
+            return an <rpc-error> element with an <error-tag> value of
+            'invalid-value'.";
+       }
+     }
+   }
diff --git a/tests/utests/data/test_parser_json.c b/tests/utests/data/test_parser_json.c
index 6a50913..92cbe2c 100644
--- a/tests/utests/data/test_parser_json.c
+++ b/tests/utests/data/test_parser_json.c
@@ -496,15 +496,18 @@
     struct ly_in *in;
     struct lyd_node *tree, *op;
     const struct lyd_node *node;
-    const char *dsc = "The <edit-config> operation loads all or part of a specified\n"
-            "configuration to the specified target configuration.";
-    const char *ref = "RFC 6241, Section 7.2";
-    const char *feats[] = {"writable-running", NULL};
+    const char *dsc = "Edit data in an NMDA datastore.\n"
+            "\n"
+            "If an error condition occurs such that an error severity\n"
+            "<rpc-error> element is generated, the server will stop\n"
+            "processing the <edit-data> operation and restore the\n"
+            "specified configuration to its complete state at\n"
+            "the start of this <edit-data> operation.";
 
-    assert_non_null((ly_ctx_load_module(UTEST_LYCTX, "ietf-netconf", "2011-06-01", feats)));
+    assert_non_null((ly_ctx_load_module(UTEST_LYCTX, "ietf-netconf-nmda", "2019-01-07", NULL)));
 
-    data = "{\"ietf-netconf:edit-config\":{"
-            "\"target\":{\"running\":[null]},"
+    data = "{\"ietf-netconf-nmda:edit-data\":{"
+            "\"datastore\":\"ietf-datastores:running\","
             "\"config\":{\"a:cp\":{\"z\":[null],\"@z\":{\"ietf-netconf:operation\":\"replace\"}},"
             "\"a:l1\":[{\"@\":{\"ietf-netconf:operation\":\"replace\"},\"a\":\"val_a\",\"b\":\"val_b\",\"c\":\"val_c\"}]}"
             "}}";
@@ -515,16 +518,16 @@
     assert_non_null(op);
 
     CHECK_LYSC_ACTION((struct lysc_node_action *)op->schema, dsc, 0, LYS_STATUS_CURR,
-            1, 0, 0, 1, "edit-config", LYS_RPC,
-            0, 0, 0, 0, 0, ref, 0);
+            1, 0, 0, 1, "edit-data", LYS_RPC,
+            0, 0, 0, 0, 0, NULL, 0);
 
     node = tree;
     CHECK_LYSC_ACTION((struct lysc_node_action *)node->schema, dsc, 0, LYS_STATUS_CURR,
-            1, 0, 0, 1, "edit-config", LYS_RPC,
-            0, 0, 0, 0, 0, ref, 0);
+            1, 0, 0, 1, "edit-data", LYS_RPC,
+            0, 0, 0, 0, 0, NULL, 0);
     node = lyd_child(node)->next;
-    CHECK_LYSC_NODE(node->schema, "Inline Config content.", 0, LYS_STATUS_CURR | LYS_IS_INPUT, 1, "config",
-            0, LYS_ANYXML, 1, 0, NULL, 0);
+    CHECK_LYSC_NODE(node->schema, "Inline config content.", 0, LYS_STATUS_CURR | LYS_IS_INPUT, 1, "config",
+            0, LYS_ANYDATA, 1, 0, NULL, 0);
 
     node = ((struct lyd_node_any *)node)->value.tree;
     CHECK_LYSC_NODE(node->schema, NULL, 0, LYS_CONFIG_W | LYS_STATUS_CURR | LYS_PRESENCE, 1, "cp",