Exemple #1
0
	int File::saveXML(FILE *fp, Context *ctx) {
		char *data = NULL;
		int size;

		xmlDocPtr doc = getXML(ctx);
		if (!doc) {
			goto fail;
		}

		xmlDocDumpFormatMemoryEnc(doc, (xmlChar**)&data, &size, "UTF-8", 1);

		if (size) {
			fwrite(data, size, 1, fp);
		}

		if (data) {
			xmlFree(data);
		}

		xmlFreeDoc(doc);
		return size;

	fail:
		if (data) {
			xmlFree(data);
		}

		return 0;
	}
bool ServerInterface::checkout(QStringList docs)
{
    if(m_reply == NULL)
    {
        m_getDoc = docs;
        login(SLOT(getXML()));
        return true;
    }else
    {
        return false;
    }
}
Exemple #3
0
void write(const char *path, lib::Span<const Driver * const> drivers, lib::Span<const GatorCpu> clusters)
{
    char file[PATH_MAX];

    // Set full path
    snprintf(file, PATH_MAX, "%s/events.xml", path);

    if (writeToDisk(file, getXML(drivers, clusters).get()) < 0) {
        logg.logError("Error writing %s\nPlease verify the path.", file);
        handleException();
    }
}
void CapturedXML::write(char* path) {
	char file[PATH_MAX];

	// Set full path
	snprintf(file, PATH_MAX, "%s/captured.xml", path);

	char* xml = getXML(true);
	if (util->writeToDisk(file, xml) < 0) {
		logg->logError("Error writing %s\nPlease verify the path.", file);
		handleException();
	}

	free(xml);
}
Exemple #5
0
void EventsXML::write(const char *path) {
	char file[PATH_MAX];

	// Set full path
	snprintf(file, PATH_MAX, "%s/events.xml", path);

	char *buf = getXML();
	if (util->writeToDisk(file, buf) < 0) {
		logg->logError("Error writing %s\nPlease verify the path.", file);
		handleException();
	}

	free(buf);
}
void CapturedXML::write(char* path) {
	char *file = (char*)malloc(PATH_MAX);

	// Set full path
	snprintf(file, PATH_MAX, "%s/captured.xml", path);
	
	char* xml = getXML();
	if (util->writeToDisk(file, xml) < 0) {
		logg->logError(__FILE__, __LINE__, "Error writing %s\nPlease verify the path.", file);
		handleException();
	}

	free(xml);
	free(file);
}
void ServerInterface::getXMLDone()
{
    disconnect(m_reply, SIGNAL(finished()), this, SLOT(getXMLDone()));
    m_reply->deleteLater();
    if(checkError())
    {
        QString doctype = m_getDoc.first();
        m_getDoc.removeFirst();
        QFile saveTo(m_serverPath+doctype+".xml");
        saveTo.open(QIODevice::WriteOnly);
        saveTo.write(m_reply->readAll());
        saveTo.close();
        qDebug() << "got doc" << doctype;
        if(m_getDoc.isEmpty())
        {
            m_reply = NULL;
            emit checkoutDone(m_serverPath);
        }
        else
        {
            getXML();
        }
    }
}
int get_XML_config(char* filename) {
    cfgXML = new XMLReader();
    getXML(gatAllTextFromFile(filename), cfgXML);
    return 0;
}
const tinyxml2::XMLDocument& ResourceManager::getConfigXML(std::string fileName)
{
	return getXML(CONFIG_XML_PATH, fileName);
}
const tinyxml2::XMLDocument& ResourceManager::getMenuXML(std::string fileName)
{
	return getXML(MENU_XML_PATH, fileName);
}
const tinyxml2::XMLDocument& ResourceManager::getProfileXML(std::string fileName)
{
	// TODO: ensure that we do not deliver a stale file!
	return getXML(PROFILE_XML_PATH, fileName);
}
const tinyxml2::XMLDocument& ResourceManager::getLevelXML(std::string fileName)
{
	return getXML(LEVEL_XML_PATH, fileName);
}