]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
XML: Do not add empty Value node for nodes with child nodes in TNDS
authorJouni Malinen <jouni@codeaurora.org>
Mon, 10 Sep 2018 18:43:43 +0000 (21:43 +0300)
committerJouni Malinen <jouni@codeaurora.org>
Mon, 10 Sep 2018 18:43:43 +0000 (21:43 +0300)
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 <jouni@codeaurora.org>
src/utils/xml-utils.c

index a37a92d44e7bbf4518fa63333b488766f9b92e82..dae91fee46f6c6af13c807f3a17a6ebb98f14e87 100644 (file)
@@ -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);