diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-04-16 06:59:30 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-04-16 06:59:30 (GMT) |
commit | 90f9cf977a8eb6553d6bb4963202b90e2b8ff063 (patch) | |
tree | 6bbfec29e4092632aff8ce10a8f45f7b854e0b93 /src/common/xml.c | |
parent | a4f2f3ec4b4cf7b894d6976c884fbc446396cd00 (diff) |
Created a basic tool to manage server configurations.
Diffstat (limited to 'src/common/xml.c')
-rw-r--r-- | src/common/xml.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/common/xml.c b/src/common/xml.c index a9c65b5..952aaf7 100644 --- a/src/common/xml.c +++ b/src/common/xml.c @@ -843,6 +843,61 @@ xmlNodePtr add_node_to_node(xmlDocPtr xdoc, xmlNodePtr parent, const char *name) /****************************************************************************** * * +* Paramètres : xdoc = structure XML chargée. * +* node = noeud à retirer de la structure. * +* * +* Description : Retire un noeud d'un document XML. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void _remove_node_from_doc(xmlDocPtr xdoc, xmlNodePtr node) +{ + xmlUnlinkNode(node); + xmlFreeNode(node); + +} + + +/****************************************************************************** +* * +* Paramètres : xdoc = structure XML chargée. * +* context = contexte à utiliser pour les recherches. * +* path = chemin d'accès au noeud visé. * +* * +* Description : Retire un noeud d'un document XML. * +* * +* Retour : true si le noeud XML a bien été trouvé, false sinon. * +* * +* Remarques : - * +* * +******************************************************************************/ + +bool remove_node_from_doc(xmlDocPtr xdoc, xmlXPathContextPtr context, const char *path) +{ + bool result; /* Bilan à retourner */ + xmlNodePtr node; /* Noeud à considérer */ + + node = get_node_from_xpath(context, path); + + if (node != NULL) + { + _remove_node_from_doc(xdoc, node); + result = true; + } + else + result = false; + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : xdoc = structure XML chargée. * * context = contexte à utiliser pour les recherches. * * path = chemin d'accès au noeud visé. * |