summaryrefslogtreecommitdiff
path: root/export_xml.c
diff options
context:
space:
mode:
Diffstat (limited to 'export_xml.c')
-rw-r--r--export_xml.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/export_xml.c b/export_xml.c
index f66381e..ffdeffc 100644
--- a/export_xml.c
+++ b/export_xml.c
@@ -2,6 +2,7 @@
#include <libxml/xmlsave.h>
#include "export_xml.h"
+#include "word.h"
#if !defined(LIBXML_TREE_ENABLED)
#error "libxml must be compiled with tree support"
@@ -54,6 +55,22 @@ int export_xml(struct channel_t *channel, struct user_t *users) {
}
}
+ /* Add words. */
+ xmlNodePtr words_node = xmlNewChild(root_node, NULL, "words", NULL);
+ for(int w = 0; w < WORDS_MAX; w++) {
+ struct word_t *word = &words[w];
+ while(word && word->name) {
+ char s[0xf];
+ xmlNodePtr word_node = xmlNewChild(words_node, NULL, "word", NULL);
+
+ xmlNewChild(word_node, NULL, "name", word->name);
+ sprintf(s, "%d", word->count);
+ xmlNewChild(word_node, NULL, "count", s);
+
+ word = word->next;
+ }
+ }
+
xmlSaveCtxtPtr save_context = xmlSaveToFilename(channel->xmlpath, "UTF-8", 0);
if(!save_context) {
xmlErrorPtr error = xmlGetLastError();