diff options
author | Nikias Bassen | 2013-03-07 00:20:18 +0100 |
---|---|---|
committer | Nikias Bassen | 2013-03-07 00:20:18 +0100 |
commit | c39dc2e9b5d412d4d46375a5f97600d0e56fcf87 (patch) | |
tree | cc077cb3a765a1afdbaec2472d5052c40128a3df | |
parent | 46a5feb381512cebf5a05286730edd047b989e73 (diff) | |
download | libplist-c39dc2e9b5d412d4d46375a5f97600d0e56fcf87.tar.gz libplist-c39dc2e9b5d412d4d46375a5f97600d0e56fcf87.tar.bz2 |
xml plists: make sure we don't produce <data/> if it's empty
-rw-r--r-- | src/xplist.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/xplist.c b/src/xplist.c index 6147265..ff7f2b8 100644 --- a/src/xplist.c +++ b/src/xplist.c @@ -266,6 +266,15 @@ static void node_to_xml(node_t* node, void *xml_struct) if (node_data->type == PLIST_ARRAY || node_data->type == PLIST_DICT) xmlNodeAddContent(child_node, BAD_CAST("\n")); + //make sure we don't produce <data/> if it's empty + if ((node_data->type == PLIST_DATA) && !val) { + xmlNodeAddContent(child_node, BAD_CAST("\n")); + for (i = 0; i < xstruct->depth; i++) + { + xmlNodeAddContent(child_node, BAD_CAST("\t")); + } + } + if (isStruct) { struct xml_node child = { child_node, xstruct->depth + 1 }; |