From 4f5bcdbd99fe9bfb3af5bdfa2a8bd973aa9a5bad Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Wed, 17 Dec 2008 09:43:13 +0100 Subject: Using the new eurephiaXML_* functions for creating and parsing XML Also rebased the XML file to always have a document root which is . This tag must contain a "format" attribute, which should be 1 for the moment. When parsing the XML, the eurephiaXML_getRoot(...) function will return a pointer to the requested XML node inside the document root. The format version in the root element will also be checked automatically. --- database/sqlite/administration.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'database') diff --git a/database/sqlite/administration.c b/database/sqlite/administration.c index a538adf..7e1855f 100644 --- a/database/sqlite/administration.c +++ b/database/sqlite/administration.c @@ -382,11 +382,9 @@ xmlDoc *eDBadminGetUserList(eurephiaCTX *ctx, const char *sortkeys) { // Prepare a list with all users memset(&tmp, 0, 34); - userlist = xmlNewDoc((xmlChar *)"1.0"); - root_n = xmlNewNode(NULL, (xmlChar *)"userlist"); + eurephiaXML_CreateDoc(ctx, 1, "userlist", &userlist, &root_n); snprintf(tmp, 32, "%i", sqlite_get_numtuples(res)); xmlNewProp(root_n, (xmlChar *)"usercount", (xmlChar *)tmp); - xmlDocSetRootElement(userlist, root_n); // Register all records for( i = 0; i < sqlite_get_numtuples(res); i++ ) { @@ -457,11 +455,9 @@ xmlDoc *eDBadminGetUserInfo(eurephiaCTX *ctx, int getInfo, xmlDoc *srch) { case 1: uid = atoi_nullsafe(sqlite_get_value(uinf, 0, 4)); - doc = xmlNewDoc((xmlChar *) "1.0"); - root_n = xmlNewNode(NULL, (xmlChar *) "user"); + eurephiaXML_CreateDoc(ctx, 1, "user", &doc, &root_n); sqlite_xml_value(root_n, XML_ATTR, "uid", uinf, 0, 4); sqlite_xml_value(root_n, XML_NODE, "username", uinf, 0, 0); - xmlDocSetRootElement(doc, root_n); info_n = xmlNewChild(root_n, NULL, (xmlChar *) "flags", NULL); -- cgit