From: Jouni Malinen Date: Mon, 10 Sep 2018 18:43:43 +0000 (+0300) Subject: XML: Do not add empty Value node for nodes with child nodes in TNDS X-Git-Tag: hostap_2_7~191 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=02eec9954cacb1a4b9460c3c45524ce383c7ce17;p=thirdparty%2Fhostap.git XML: Do not add empty Value node for nodes with child nodes in TNDS This fixes some validation issues against DM_ddf DTD that were caused by the conversion from the internal tree structure to TNDS. Only the leaf nodes are supposed to have the Value node. Signed-off-by: Jouni Malinen --- diff --git a/src/utils/xml-utils.c b/src/utils/xml-utils.c index a37a92d44..dae91fee4 100644 --- a/src/utils/xml-utils.c +++ b/src/utils/xml-utils.c @@ -246,7 +246,9 @@ static void node_to_tnds(struct xml_node_ctx *ctx, xml_node_t *out, xml_node_create_text(ctx, tnds, NULL, "Path", uri); val = get_val(ctx, node); - xml_node_create_text(ctx, tnds, NULL, "Value", val ? val : ""); + if (val || !xml_node_first_child(ctx, node)) + xml_node_create_text(ctx, tnds, NULL, "Value", + val ? val : ""); xml_node_get_text_free(ctx, val); new_uri = add_path(uri, name);