data parser CHANGE unify API with schema parser and use input handler
diff --git a/src/xpath.c b/src/xpath.c
index fae13dc..b14ee8c 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -33,6 +33,7 @@
#include "context.h"
#include "dict.h"
#include "hash_table.h"
+#include "parser_data.h"
#include "path.h"
#include "plugins_types.h"
#include "printer.h"
@@ -412,14 +413,13 @@
if (any->value_type == LYD_ANYDATA_LYB) {
/* try to parse it into a data tree */
- tree = lyd_parse_mem((struct ly_ctx *)LYD_NODE_CTX(node), any->value.mem, LYD_LYB,
- LYD_OPT_PARSE_ONLY | LYD_OPT_STRICT);
- if (!ly_errcode(LYD_NODE_CTX(node))) {
+ if (lyd_parse_data_mem((struct ly_ctx *)LYD_NODE_CTX(node), any->value.mem, LYD_LYB, LYD_PARSE_ONLY | LYD_PARSE_STRICT, 0, &tree) == LY_SUCCESS) {
/* successfully parsed */
free(any->value.mem);
any->value.tree = tree;
any->value_type = LYD_ANYDATA_DATATREE;
}
+ /* error is covered by the following switch where LYD_ANYDATA_LYB causes failure */
}
switch (any->value_type) {
@@ -431,7 +431,7 @@
break;
case LYD_ANYDATA_DATATREE:
LY_CHECK_RET(ly_out_new_memory(&buf, 0, &out));
- rc = lyd_print(out, any->value.tree, LYD_XML, LYDP_WITHSIBLINGS);
+ rc = lyd_print(out, any->value.tree, LYD_XML, LYD_PRINT_WITHSIBLINGS);
ly_out_free(out, NULL, 0);
LY_CHECK_RET(rc < 0, -rc);
break;