summaryrefslogtreecommitdiff
path: root/src/common/xml.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-03-20 22:52:48 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-03-20 22:52:48 (GMT)
commit18d6b808db6e31e867525d68f92d6f928a7ab5a7 (patch)
treed534c8e374004866696322a4c3f58ae2a7a545d9 /src/common/xml.c
parent84790a5b420d0a9ce658013573b180ce059db325 (diff)
Created the first steps for a distributed storage.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@368 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/common/xml.c')
-rw-r--r--src/common/xml.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/common/xml.c b/src/common/xml.c
index 5612247..2d38f96 100644
--- a/src/common/xml.c
+++ b/src/common/xml.c
@@ -30,6 +30,7 @@
#include <string.h>
+#include "cpp.h"
#include "extstr.h"
@@ -868,6 +869,39 @@ bool add_content_to_node(xmlDocPtr xdoc, xmlXPathContextPtr context, const char
/******************************************************************************
* *
+* Paramètres : xdoc = structure XML chargée. *
+* context = contexte à utiliser pour les recherches. *
+* path = chemin d'accès au noeud visé. *
+* value = nombre à inscrire en contenu. *
+* *
+* Description : Ajoute un noeud avec contenu numérique au document. *
+* *
+* Retour : true en cas de succès, false sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool add_uint_content_to_node(xmlDocPtr xdoc, xmlXPathContextPtr context, const char *path, unsigned int value)
+{
+ xmlNodePtr node; /* Noeud à modifier */
+ char content[sizeof(STR(UINT_MAX)) + 1];/* Valeur en chaîne */
+
+ if (content == NULL) return true;
+
+ node = ensure_node_exist(xdoc, context, path);
+ if (node == NULL) return false;
+
+ sprintf(content, "%u", value);
+ xmlNodeSetContent(node, BAD_CAST content);
+
+ return true;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : node = noeud dont le contenu est à mettre à jour. *
* name = nom de la propriété à créer. *
* value = chaîne de caractère à placer. *