int xmldb_init()
{
    if (_storage != NULL)
    {
        //TODO: replace with mega log
        log_error("Storage has been already initialized!");
        return -1;
    }

    int error = ixmlDocument_createDocumentEx(&_storage);
    if (error != IXML_SUCCESS)
    {
        log_error("Unable to initialize the storage. (error %d).", error);
        return error;
    }

    // load storage contents from files:
    log_debug("Loading server storage data from files..");
    int i;
    for (i = 0; i < OBIX_STORAGE_FILES_COUNT; i++)
    {
        error = xmldb_loadFile(OBIX_STORAGE_FILES[i]);
        if (error != 0)
        {
            return error;
        }
    }

    log_debug("Storage is initialized!");
    return 0;
}
Exemple #2
0
IXML_Document *ixmlDocument_createDocument()
{
	IXML_Document *doc = NULL;

	ixmlDocument_createDocumentEx(&doc);

	return doc;
}