XML: print empty tags for requested fields

This commit is contained in:
Jan-Piet Mens
2015-10-22 09:30:03 +02:00
parent 5ec8f04e61
commit b06f224e27
+6 -1
View File
@@ -1119,7 +1119,6 @@ static void emit_one(JsonNode *j, JsonNode *inttypes, void (func)(char *line, vo
{
static UT_string *line = NULL;
if (!strcmp(j->key, "_type"))
return;
@@ -1180,6 +1179,12 @@ void xml_output(JsonNode *json, output_type otype, JsonNode *fields, void (*func
json_foreach(node, fields) {
if ((j = json_find_member(one, node->string_)) != NULL) {
emit_one(j, inttypes, func, param);
} else {
/* empty element */
char label[128];
snprintf(label, sizeof(label), " <%s />", node->string_);
func(label, param);
}
}
} else {