schema tree FEATURE getter for expr from parsed xpath
diff --git a/src/tree_schema.h b/src/tree_schema.h
index 61b4c22..aac43bf 100644
--- a/src/tree_schema.h
+++ b/src/tree_schema.h
@@ -2054,11 +2054,20 @@
/**
* @brief Stringify schema nodetype.
+ *
* @param[in] nodetype Nodetype to stringify.
* @return Constant string with the name of the node's type.
*/
const char *lys_nodetype2str(uint16_t nodetype);
+/**
+ * @brief Getter for original XPath expression from a parsed expression.
+ *
+ * @param[in] path Parsed expression.
+ * @return Original string expression.
+ */
+const char *lyxp_get_expr(const struct lyxp_expr *path);
+
/** @} schematree */
#ifdef __cplusplus
diff --git a/src/xpath.c b/src/xpath.c
index 4b6fa67..c104dd3 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -8697,3 +8697,13 @@
/* evaluate */
return eval_expr_select(exp, &tok_idx, 0, set, options);
}
+
+API const char *
+lyxp_get_expr(const struct lyxp_expr *path)
+{
+ if (!path) {
+ return NULL;
+ }
+
+ return path->expr;
+}