diff options
author | Martin Szulecki | 2010-01-09 10:49:23 +0100 |
---|---|---|
committer | Jonathan Beck | 2010-01-14 18:36:26 +0100 |
commit | 874942ec1600773622238ae28544908d292ef339 (patch) | |
tree | 9c3ef9acba7ecdf64eb888b16617a1a38c9c16ed /src/xplist.c | |
parent | 54f1ffb0f4b1d4808db76fe8d35c240c22fea819 (diff) | |
download | libplist-874942ec1600773622238ae28544908d292ef339.tar.gz libplist-874942ec1600773622238ae28544908d292ef339.tar.bz2 |
Make sure to convert predefined xml entities in xml output
For string nodes, a set of special characters must be converted to
predefined xml entities. This patch adds an entitiy test case for
this and makes libplist pass it fine by explicitly adding text nodes.
Diffstat (limited to 'src/xplist.c')
-rw-r--r-- | src/xplist.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/xplist.c b/src/xplist.c index 15c9497..ce8dec1 100644 --- a/src/xplist.c +++ b/src/xplist.c @@ -196,7 +196,12 @@ static void node_to_xml(GNode * node, gpointer xml_struct) { xmlNodeAddContent(xstruct->xml, BAD_CAST("\t")); } - child_node = xmlNewChild(xstruct->xml, NULL, tag, BAD_CAST(val)); + if (node_data->type == PLIST_STRING) { + /* make sure we convert the following predefined xml entities */ + /* < = < > = > ' = ' " = " & = & */ + child_node = xmlNewTextChild(xstruct->xml, NULL, tag, BAD_CAST(val)); + } else + child_node = xmlNewChild(xstruct->xml, NULL, tag, BAD_CAST(val)); xmlNodeAddContent(xstruct->xml, BAD_CAST("\n")); g_free(val); |