libyang
libyang copied to clipboard
The lyd_parse_data_mem function cannot process data other than invalid data.
module:
container testsdk {
container TsdkTypeInners {
list TsdkTypeInner {
key "TestIndex TestName";
config true;
mo:global-max-elements "1000000";
leaf TestIndex {
type uint32 {
range "0..4294967295";
}
mandatory true;
mo:indexAssignMode "INC";
mo:isIndexField "true";
}
leaf TestName {
type string {
length "0..50";
}
mandatory true;
}
leaf TestString2 {
type string {
length "0..20";
}
mandatory false;
}
}
}
When invalid data is constructed and the lyd_parse_data_mem function is invoked for parsing, subsequent data parsing is ignored:
LY_ERR ret = lyd_parse_data_mem(pstLocal->stServer.pstYang, xmlStr, LYD_XML, LYD_PARSE_ONLY | LYD_PARSE_NO_STATE,
LYD_VALIDATE_PRESENT | LYD_VALIDATE_NO_STATE, &pstTree1);
Is this as expected? Which of the following options can be used to skip only invalid data to ensure that subsequent valid data can be parsed?
You have mixed the options, when using LYD_PARSE_ONLY, validation options should be 0, so try that.