data tree CHANGE remove restriction for root XML node in lyd_parse()
Since the data parser supports options, it is not needed to have any
requirements to the XML root element passed to the lyd_parse()
diff --git a/src/libyang.h b/src/libyang.h
index 94acc82..cf9f77e 100644
--- a/src/libyang.h
+++ b/src/libyang.h
@@ -342,8 +342,9 @@
/**
* @brief Parse (and validate according to appropriate schema from the given context) data.
*
- * In case of LY_XML format, the data string is expected to contain XML data under the single
- * \<config\> or \<data\> element in the "urn:ietf:params:xml:ns:netconf:base:1.0" namespace.
+ * In case of LY_XML format, the data string is expected to contain XML data under a single
+ * XML element. The element is not parsed, but it is expected to keep XML data well formed in all
+ * cases. There are no restrictions for the element name or its namespace.
*
* LY_JSON format is not yet supported.
*
diff --git a/src/parser/xml.c b/src/parser/xml.c
index 085ce54..2930efd 100644
--- a/src/parser/xml.c
+++ b/src/parser/xml.c
@@ -1082,12 +1082,6 @@
return NULL;
}
- /* check the returned data - the root must be config or data in NETCONF namespace */
- if (!xml->ns || strcmp(xml->ns->value, LY_NSNC) || (strcmp(xml->name, "data") && strcmp(xml->name, "config"))) {
- LOGERR(LY_EINVAL, "XML data parser expect <data> or <config> root in \"%s\" namespace.", LY_NSNC);
- return NULL;
- }
-
ly_errno = 0;
result = xml_parse_data(ctx, xml->child, NULL, NULL, options, &unres);
/* check leafrefs and/or instids if any */