docs FIX mistakes in yin parser documentation
diff --git a/src/parser_yin.c b/src/parser_yin.c
index adf9b0c..eda68c7 100644
--- a/src/parser_yin.c
+++ b/src/parser_yin.c
@@ -91,10 +91,10 @@
}
}
-enum YIN_ARGUMENT
+enum yin_argument
yin_match_argument_name(const char *name, size_t len)
{
- enum YIN_ARGUMENT arg = YIN_ARG_UNKNOWN;
+ enum yin_argument arg = YIN_ARG_UNKNOWN;
size_t already_read = 0;
LY_CHECK_RET(len == 0, YIN_ARG_NONE);
@@ -167,19 +167,20 @@
{
LY_ERR ret = LY_SUCCESS;
struct yin_arg_record *argument_record = NULL;
- struct sized_string prefix, name;
+ const char *prefix, *name;
+ size_t prefix_len, name_len;
/* load all attributes */
while (ctx->xml_ctx.status == LYXML_ATTRIBUTE) {
- ret = lyxml_get_attribute(&ctx->xml_ctx, data, &prefix.value, &prefix.len, &name.value, &name.len);
+ ret = lyxml_get_attribute(&ctx->xml_ctx, data, &prefix, &prefix_len, &name, &name_len);
LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
if (ctx->xml_ctx.status == LYXML_ATTR_CONTENT) {
LY_ARRAY_NEW_GOTO(ctx->xml_ctx.ctx, *attrs, argument_record, ret, cleanup);
- argument_record->name = name.value;
- argument_record->name_len = name.len;
- argument_record->prefix = prefix.value;
- argument_record->prefix_len = prefix.len;
+ argument_record->name = name;
+ argument_record->name_len = name_len;
+ argument_record->prefix = prefix;
+ argument_record->prefix_len = prefix_len;
ret = lyxml_get_string(&ctx->xml_ctx, data, &argument_record->content, &argument_record->content_len,
&argument_record->content, &argument_record->content_len, &argument_record->dynamic_content);
LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
@@ -239,10 +240,10 @@
* @return LY_ERR values.
*/
static LY_ERR
-yin_parse_attribute(struct yin_parser_ctx *ctx, struct yin_arg_record *attrs, enum YIN_ARGUMENT arg_type,
+yin_parse_attribute(struct yin_parser_ctx *ctx, struct yin_arg_record *attrs, enum yin_argument arg_type,
const char **arg_val, enum yang_arg val_type, enum yang_keyword current_element)
{
- enum YIN_ARGUMENT arg = YIN_ARG_UNKNOWN;
+ enum yin_argument arg = YIN_ARG_UNKNOWN;
struct yin_arg_record *iter = NULL;
bool found = false;
@@ -413,7 +414,7 @@
*/
static LY_ERR
yin_parse_simple_element(struct yin_parser_ctx *ctx, struct yin_arg_record *attrs, const char **data, enum yang_keyword kw,
- const char **value, enum YIN_ARGUMENT arg_type, enum yang_arg arg_val_type, struct lysp_ext_instance **exts)
+ const char **value, enum yin_argument arg_type, enum yang_arg arg_val_type, struct lysp_ext_instance **exts)
{
LY_CHECK_RET(yin_parse_attribute(ctx, attrs, arg_type, value, arg_val_type, kw));
struct yin_subelement subelems[1] = {
@@ -466,6 +467,16 @@
return yin_parse_content(ctx, subelems, 6, data, YANG_PATTERN, NULL, &restr->exts);
}
+/**
+ * @brief Parse fraction-digits element.
+ *
+ * @param[in,out] ctx Yin parser context for logging and to store current state.
+ * @param[in] attrs [Sized array](@ref sizedarrays) of attributes of current element.
+ * @param[in,out] data Data to read from, always moved to currently handled character.
+ * @param[in,out] type Type structure to store value, flags and extension instances.
+ *
+ * @return LY_ERR values.
+ */
static LY_ERR
yin_parse_fracdigits(struct yin_parser_ctx *ctx, struct yin_arg_record *attrs, const char **data,
struct lysp_type *type)
@@ -510,7 +521,7 @@
* @param[in] attrs [Sized array](@ref sizedarrays) of attributes of current element.
* @param[in,out] data Data to read from, always moved to currently handled character.
* @param[in] enum_kw Identification of actual keyword, can be set to YANG_BIT or YANG_ENUM.
- * @param[in,out] enums Enums or bits to add to.
+ * @param[in,out] type Type structure to store enum value, flags and extension instances.
*
* @return LY_ERR values.
*/
@@ -544,7 +555,7 @@
* @param[in] attrs [Sized array](@ref sizedarrays) of attributes of current element.
* @param[in,out] data Data to read from, always moved to currently handled character.
* @param[in] enum_kw Identification of actual keyword, can be set to YANG_BIT or YANG_ENUM.
- * @param[in,out] enums Enums or bits to add to.
+ * @param[in,out] type Type structure to store bit value, flags and extension instances.
*
* @return LY_ERR values.
*/
@@ -587,7 +598,7 @@
*/
static LY_ERR
yin_parse_simple_elements(struct yin_parser_ctx *ctx, struct yin_arg_record *attrs, const char **data, enum yang_keyword kw,
- const char ***values, enum YIN_ARGUMENT arg_type, enum yang_arg arg_val_type, struct lysp_ext_instance **exts)
+ const char ***values, enum yin_argument arg_type, enum yang_arg arg_val_type, struct lysp_ext_instance **exts)
{
const char **value;
LY_ARRAY_NEW_RET(ctx->xml_ctx.ctx, *values, value, LY_EMEM);
@@ -699,7 +710,7 @@
{YANG_CUSTOM, NULL, 0}
};
/* argument of must is called condition, but argument of length and range is called value */
- enum YIN_ARGUMENT arg_type = (restr_kw == YANG_MUST) ? YIN_ARG_CONDITION : YIN_ARG_VALUE;
+ enum yin_argument arg_type = (restr_kw == YANG_MUST) ? YIN_ARG_CONDITION : YIN_ARG_VALUE;
LY_CHECK_RET(yin_parse_attribute(ctx, attrs, arg_type, &restr->arg, Y_STR_ARG, restr_kw));
return yin_parse_content(ctx, subelems, 5, data, restr_kw, NULL, &restr->exts);
@@ -2523,6 +2534,15 @@
}
}
+/**
+ * @brief map keyword to keyword-group.
+ *
+ * @param[in] ctx YIN parser context used for logging.
+ * @param[in] kw Keyword that is child of module or submodule.
+ * @param[out] group Group of keyword.
+ *
+ * @return LY_SUCCESS on success LY_EINT if kw can't be mapped to kw_group, should not happen if called correctly.
+ */
static LY_ERR
kw2kw_group(struct yin_parser_ctx *ctx, enum yang_keyword kw, enum yang_module_stmt *group)
{
@@ -2580,6 +2600,17 @@
return LY_SUCCESS;
}
+/**
+ * @brief Check if relative order of two keywords is valid.
+ *
+ * @param[in] ctx YIN parser context used for logging.
+ * @param[in] kw Current keyword.
+ * @param[in] next_kw Next keyword.
+ * @param[in] parrent Identification of parrent element, can be se to to YANG_MODULE of YANG_SUBMODULE,
+ * because relative order is required only in module and submodule sub-elements, used for logging.
+ *
+ * @return LY_SUCCESS on succes and LY_EVALID if relative order is invalid.
+ */
static LY_ERR
yin_check_relative_order(struct yin_parser_ctx *ctx, enum yang_keyword kw, enum yang_keyword next_kw, enum yang_keyword parrent)
{
@@ -2602,9 +2633,9 @@
const char **data, enum yang_keyword current_element, const char **text_content, struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
- struct sized_string prefix, name;
char *out = NULL;
- size_t out_len = 0;
+ const char *prefix, *name;
+ size_t out_len = 0, prefix_len, name_len;
int dynamic = 0;
struct yin_arg_record *attrs = NULL;
enum yang_keyword kw = YANG_NONE, last_kw = YANG_NONE;
@@ -2618,16 +2649,16 @@
/* current element has subelements as content */
if (ret == LY_EINVAL) {
while (ctx->xml_ctx.status == LYXML_ELEMENT) {
- ret = lyxml_get_element(&ctx->xml_ctx, data, &prefix.value, &prefix.len, &name.value, &name.len);
+ ret = lyxml_get_element(&ctx->xml_ctx, data, &prefix, &prefix_len, &name, &name_len);
LY_CHECK_GOTO(ret, cleanup);
- if (!name.value) {
+ if (!name) {
/* end of current element reached */
break;
}
ret = yin_load_attributes(ctx, data, &attrs);
LY_CHECK_GOTO(ret, cleanup);
last_kw = kw;
- kw = yin_match_keyword(ctx, name.value, name.len, prefix.value, prefix.len, current_element);
+ kw = yin_match_keyword(ctx, name, name_len, prefix, prefix_len, current_element);
/* check if this element can be child of current element */
subelem = get_record(kw, subelem_info_size, subelem_info);
@@ -2635,7 +2666,7 @@
if (current_element == YANG_DEVIATE && isdevsub(kw)) {
LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_INDEV_YIN, ly_stmt2str(kw));
} else {
- LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_UNEXP_SUBELEM, name.len, name.value, ly_stmt2str(current_element));
+ LOGVAL_PARSER((struct lys_parser_ctx *)ctx, LY_VCODE_UNEXP_SUBELEM, name_len, name, ly_stmt2str(current_element));
}
ret = LY_EVALID;
goto cleanup;
@@ -2671,8 +2702,8 @@
switch (kw) {
/* call responsible function */
case YANG_CUSTOM:
- ret = yin_parse_extension_instance(ctx, attrs, data, name2fullname(name.value, prefix.len),
- namelen2fulllen(name.len, prefix.len),
+ ret = yin_parse_extension_instance(ctx, attrs, data, name2fullname(name, prefix_len),
+ namelen2fulllen(name_len, prefix_len),
kw2lyext_substmt(current_element),
(subelem->dest) ? *((uint32_t*)subelem->dest) : 0, exts);
break;
@@ -2924,7 +2955,7 @@
} else {
/* elements with text or none content */
/* save text content, if text_content isn't set, it's just ignored */
- /* no resources are allocated in this branch so no need to use cleanup label */
+ /* no resources are allocated in this branch, no need to use cleanup label */
LY_CHECK_RET(yin_validate_value(ctx, Y_STR_ARG, out, out_len));
if (text_content) {
if (dynamic) {
@@ -2942,7 +2973,7 @@
}
}
/* load closing element */
- LY_CHECK_RET(lyxml_get_element(&ctx->xml_ctx, data, &prefix.value, &prefix.len, &name.value, &name.len));
+ LY_CHECK_RET(lyxml_get_element(&ctx->xml_ctx, data, &prefix, &prefix_len, &name, &name_len));
}
}
/* mandatory subelemnts are checked only after whole element was succesfully parsed */
diff --git a/src/parser_yin.h b/src/parser_yin.h
index 7554ad0..eda898c 100644
--- a/src/parser_yin.h
+++ b/src/parser_yin.h
@@ -1,7 +1,7 @@
/**
* @file parser_yin.h
* @author David Sedlák <xsedla1d@stud.fit.vutbr.cz>
- * @brief YIN parser.
+ * @brief YIN parser header file.
*
* Copyright (c) 2015 - 2019 CESNET, z.s.p.o.
*
@@ -35,9 +35,7 @@
kw == YANG_MUST || kw == YANG_TYPE || kw == YANG_UNIQUE || \
kw == YANG_UNITS || kw == YANG_CUSTOM)
-/* get deviate type from */
-
-enum YIN_ARGUMENT {
+enum yin_argument {
YIN_ARG_UNKNOWN = 0, /**< parsed argument can not be matched with any supported yin argument keyword */
YIN_ARG_NAME, /**< argument name */
YIN_ARG_TARGET_NODE, /**< argument target-node */
@@ -64,7 +62,7 @@
int dynamic_content; /**< is set to 1 iff content is dynamically allocated 0 otherwise */
};
-/* flags to encode cardinality of subelement */
+/* flags to set constraints of subelements */
#define YIN_SUBELEM_MANDATORY 0x01 /**< is set when subelement is mandatory */
#define YIN_SUBELEM_UNIQUE 0x02 /**< is set when subelement is unique */
#define YIN_SUBELEM_FIRST 0x04 /**< is set when subelement is actually yang argument mapped to yin element */
@@ -76,13 +74,7 @@
struct yin_subelement {
enum yang_keyword type; /**< type of keyword */
void *dest; /**< meta infromation passed to responsible function (mostly information about where parsed subelement should be stored) */
- uint8_t flags; /**< describes cardianlity of subelement can be set to YIN_SUBELEM_MANDATORY and YIN_SUBELEM_UNIQUE and YIN_SUBELEM_FIRST */
-};
-
-/* helper structure just to make code look simpler */
-struct sized_string {
- const char *value;
- size_t len;
+ uint8_t flags; /**< describes constraints of subelement can be set to YIN_SUBELEM_MANDATORY, YIN_SUBELEM_UNIQUE, YIN_SUBELEM_FIRST and YIN_SUBELEM_VER2 */
};
/* Meta information passed to yin_parse_argument function,
@@ -160,7 +152,7 @@
*
* @return YIN_ARGUMENT value.
*/
-enum YIN_ARGUMENT yin_match_argument_name(const char *name, size_t len);
+enum yin_argument yin_match_argument_name(const char *name, size_t len);
/**
* @brief Generic function for content parsing
@@ -171,9 +163,9 @@
* @param[in] subelem_info_size Size of subelem_info array.
* @param[in,out] data Data to read from, always moved to currently handled character.
* @param[in] current_element Type of current element.
- * @param[out] text_content Where the text content of element should be stored if any. Text content is ignored if set to NULL.
+ * @param[out] text_content Where the text content of element should be stored if any. Text content is ignored if not set to NULL.
* @param[in,out] exts Extension instance to add to. Can be se to null if element cannot have extension as subelements.
-
+ *
* @return LY_ERR values.
*/
LY_ERR yin_parse_content(struct yin_parser_ctx *ctx, struct yin_subelement *subelem_info, signed char subelem_info_size,
@@ -200,7 +192,7 @@
* @param[in] name Start of keyword name
* @param[in] name_len Lenght of keyword name.
* @param[in] prefix Start of keyword prefix.
- * @param[in] prefix_len lenght of prefix.
+ * @param[in] prefix_len Lenght of prefix.
* @param[in] parrent Identification of parrent element, use YANG_NONE for elements without parrent.
*
* @return yang_keyword values.
@@ -209,7 +201,7 @@
const char *prefix, size_t prefix_len, enum yang_keyword parrent);
/**
- * @brief load all attributes of element into ([sized array](@ref sizedarrays)). Caller is suposed to free the array.
+ * @brief Load all attributes of element into ([sized array](@ref sizedarrays)). Caller is suposed to free the array.
*
* @param[in,out] ctx Yin parser context for logging and to store current state.
* @param[in,out] data Data to read from, always moved to currently handled character.
@@ -282,7 +274,8 @@
* @brief free argument record, content loaded from lyxml_get_string() can be
* dynamically allocated in some cases so it must be also freed.
*
- * @param ctx unused just to fulfill
+ * @param ctx unused just to fulfill signature of callback for FREE_ARRAY.
+ * @param[in] record Record to free.
*/
void free_arg_rec(struct yin_parser_ctx *ctx, struct yin_arg_record *record);
diff --git a/tests/src/test_parser_yin.c b/tests/src/test_parser_yin.c
index 2a55ab9..1104994 100644
--- a/tests/src/test_parser_yin.c
+++ b/tests/src/test_parser_yin.c
@@ -459,7 +459,8 @@
{
struct state *st = *state;
LY_ERR ret = LY_SUCCESS;
- struct sized_string name, prefix;
+ const char *name, *prefix;
+ size_t name_len, prefix_len;
const char *data = "<prefix value=\"a_mod\" xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">"
"<custom xmlns=\"my-ext\">"
"totally amazing extension"
@@ -504,7 +505,7 @@
struct lysp_type req_type = {}, range_type = {}, len_type = {}, patter_type = {}, enum_type = {};
uint8_t config = 0;
- lyxml_get_element(&st->yin_ctx->xml_ctx, &data, &prefix.value, &prefix.len, &name.value, &name.len);
+ lyxml_get_element(&st->yin_ctx->xml_ctx, &data, &prefix, &prefix_len, &name, &name_len);
yin_load_attributes(st->yin_ctx, &data, &attrs);
struct yin_subelement subelems[17] = {
@@ -589,7 +590,7 @@
"<text xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">wsefsdf</text>"
"<text xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\">wsefsdf</text>"
ELEMENT_WRAPPER_END;
- lyxml_get_element(&st->yin_ctx->xml_ctx, &data, &prefix.value, &prefix.len, &name.value, &name.len);
+ lyxml_get_element(&st->yin_ctx->xml_ctx, &data, &prefix, &prefix_len, &name, &name_len);
yin_load_attributes(st->yin_ctx, &data, &attrs);
ret = yin_parse_content(st->yin_ctx, subelems2, 2, &data, YANG_STATUS, NULL, &exts);
assert_int_equal(ret, LY_EVALID);
@@ -608,7 +609,7 @@
ELEMENT_WRAPPER_END;
struct yin_subelement subelems3[2] = {{YANG_PREFIX, &prefix_value, 0},
{YIN_TEXT, &value, YIN_SUBELEM_FIRST}};
- lyxml_get_element(&st->yin_ctx->xml_ctx, &data, &prefix.value, &prefix.len, &name.value, &name.len);
+ lyxml_get_element(&st->yin_ctx->xml_ctx, &data, &prefix, &prefix_len, &name, &name_len);
yin_load_attributes(st->yin_ctx, &data, &attrs);
ret = yin_parse_content(st->yin_ctx, subelems3, 2, &data, YANG_STATUS, NULL, &exts);
assert_int_equal(ret, LY_EVALID);
@@ -621,7 +622,7 @@
/* test mandatory subelem */
data = ELEMENT_WRAPPER_START ELEMENT_WRAPPER_END;
struct yin_subelement subelems4[1] = {{YANG_PREFIX, &prefix_value, YIN_SUBELEM_MANDATORY}};
- lyxml_get_element(&st->yin_ctx->xml_ctx, &data, &prefix.value, &prefix.len, &name.value, &name.len);
+ lyxml_get_element(&st->yin_ctx->xml_ctx, &data, &prefix, &prefix_len, &name, &name_len);
yin_load_attributes(st->yin_ctx, &data, &attrs);
ret = yin_parse_content(st->yin_ctx, subelems4, 1, &data, YANG_STATUS, NULL, &exts);
assert_int_equal(ret, LY_EVALID);
@@ -651,7 +652,8 @@
struct lysp_ext_instance **exts, bool valid)
{
struct yin_arg_record *attrs = NULL;
- struct sized_string name, prefix;
+ const char *name, *prefix;
+ size_t name_len, prefix_len;
LY_ERR ret = LY_SUCCESS;
struct yin_subelement subelems[71] = {
{YANG_ACTION, dest, 0},
@@ -726,9 +728,9 @@
{YIN_TEXT, dest, 0},
{YIN_VALUE, dest, 0}
};
- LY_CHECK_RET(lyxml_get_element(&st->yin_ctx->xml_ctx, data, &prefix.value, &prefix.len, &name.value, &name.len));
+ LY_CHECK_RET(lyxml_get_element(&st->yin_ctx->xml_ctx, data, &prefix, &prefix_len, &name, &name_len));
LY_CHECK_RET(yin_load_attributes(st->yin_ctx, data, &attrs));
- ret = yin_parse_content(st->yin_ctx, subelems, 71, data, yin_match_keyword(st->yin_ctx, name.value, name.len, prefix.value, prefix.len, YANG_NONE), text, exts);
+ ret = yin_parse_content(st->yin_ctx, subelems, 71, data, yin_match_keyword(st->yin_ctx, name, name_len, prefix, prefix_len, YANG_NONE), text, exts);
LY_ARRAY_FREE(attrs);
if (valid) {
assert_int_equal(st->yin_ctx->xml_ctx.status, LYXML_END);
@@ -3844,9 +3846,9 @@
test_module_elem(void **state)
{
struct state *st = *state;
- const char *data;
+ const char *data, *name, *prefix;
+ size_t name_len, prefix_len;
struct yin_arg_record *attrs = NULL;
- struct sized_string name, prefix;
struct lys_module *lys_mod = NULL;
struct lysp_module *lysp_mod = NULL;
@@ -3886,7 +3888,7 @@
"<typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>\n"
EXT_SUBELEM"\n"
"</module>\n";
- assert_int_equal(lyxml_get_element(&st->yin_ctx->xml_ctx, &data, &prefix.value, &prefix.len, &name.value, &name.len), LY_SUCCESS);
+ assert_int_equal(lyxml_get_element(&st->yin_ctx->xml_ctx, &data, &prefix, &prefix_len, &name, &name_len), LY_SUCCESS);
assert_int_equal(yin_load_attributes(st->yin_ctx, &data, &attrs), LY_SUCCESS);
assert_int_equal(yin_parse_mod(st->yin_ctx, attrs, &data, lysp_mod), LY_SUCCESS);
assert_string_equal(lysp_mod->mod->name, "mod");
@@ -3946,7 +3948,7 @@
"<prefix value=\"pref\"/>"
"<yang-version value=\"1.1\"/>"
"</module>";
- assert_int_equal(lyxml_get_element(&st->yin_ctx->xml_ctx, &data, &prefix.value, &prefix.len, &name.value, &name.len), LY_SUCCESS);
+ assert_int_equal(lyxml_get_element(&st->yin_ctx->xml_ctx, &data, &prefix, &prefix_len, &name, &name_len), LY_SUCCESS);
assert_int_equal(yin_load_attributes(st->yin_ctx, &data, &attrs), LY_SUCCESS);
assert_int_equal(yin_parse_mod(st->yin_ctx, attrs, &data, lysp_mod), LY_SUCCESS);
assert_string_equal(lysp_mod->mod->name, "mod");
@@ -3967,7 +3969,7 @@
"<prefix value=\"pref\"/>"
"<yang-version value=\"1.1\"/>"
"</module>";
- assert_int_equal(lyxml_get_element(&st->yin_ctx->xml_ctx, &data, &prefix.value, &prefix.len, &name.value, &name.len), LY_SUCCESS);
+ assert_int_equal(lyxml_get_element(&st->yin_ctx->xml_ctx, &data, &prefix, &prefix_len, &name, &name_len), LY_SUCCESS);
assert_int_equal(yin_load_attributes(st->yin_ctx, &data, &attrs), LY_SUCCESS);
assert_int_equal(yin_parse_mod(st->yin_ctx, attrs, &data, lysp_mod), LY_EVALID);
logbuf_assert("Invalid order of module\'s sub-elements \"namespace\" can\'t appear after \"feature\". Line number 30.");
@@ -3983,9 +3985,9 @@
test_submodule_elem(void **state)
{
struct state *st = *state;
- const char *data;
+ const char *data, *name, *prefix;
+ size_t name_len, prefix_len;
struct yin_arg_record *attrs = NULL;
- struct sized_string name, prefix;
struct lysp_submodule *lysp_submod = NULL;
/* max subelements */
@@ -4020,7 +4022,7 @@
"<typedef name=\"tpdf\"> <type name=\"type\"/> </typedef>\n"
EXT_SUBELEM"\n"
"</submodule>\n";
- assert_int_equal(lyxml_get_element(&st->yin_ctx->xml_ctx, &data, &prefix.value, &prefix.len, &name.value, &name.len), LY_SUCCESS);
+ assert_int_equal(lyxml_get_element(&st->yin_ctx->xml_ctx, &data, &prefix, &prefix_len, &name, &name_len), LY_SUCCESS);
assert_int_equal(yin_load_attributes(st->yin_ctx, &data, &attrs), LY_SUCCESS);
assert_int_equal(yin_parse_submod(st->yin_ctx, attrs, &data, lysp_submod), LY_SUCCESS);
@@ -4076,7 +4078,7 @@
"<yang-version value=\"1.0\"/>"
"<belongs-to module=\"mod-name\"><prefix value=\"pref\"/></belongs-to>"
"</submodule>";
- assert_int_equal(lyxml_get_element(&st->yin_ctx->xml_ctx, &data, &prefix.value, &prefix.len, &name.value, &name.len), LY_SUCCESS);
+ assert_int_equal(lyxml_get_element(&st->yin_ctx->xml_ctx, &data, &prefix, &prefix_len, &name, &name_len), LY_SUCCESS);
assert_int_equal(yin_load_attributes(st->yin_ctx, &data, &attrs), LY_SUCCESS);
assert_int_equal(yin_parse_submod(st->yin_ctx, attrs, &data, lysp_submod), LY_SUCCESS);
assert_string_equal(lysp_submod->prefix, "pref");
@@ -4094,7 +4096,7 @@
"<reference><text>ref</text></reference>\n"
"<belongs-to module=\"mod-name\"><prefix value=\"pref\"/></belongs-to>"
"</submodule>";
- assert_int_equal(lyxml_get_element(&st->yin_ctx->xml_ctx, &data, &prefix.value, &prefix.len, &name.value, &name.len), LY_SUCCESS);
+ assert_int_equal(lyxml_get_element(&st->yin_ctx->xml_ctx, &data, &prefix, &prefix_len, &name, &name_len), LY_SUCCESS);
assert_int_equal(yin_load_attributes(st->yin_ctx, &data, &attrs), LY_SUCCESS);
assert_int_equal(yin_parse_submod(st->yin_ctx, attrs, &data, lysp_submod), LY_EVALID);
logbuf_assert("Invalid order of submodule's sub-elements \"belongs-to\" can't appear after \"reference\". Line number 28.");