MOBI_RET mobi_xml_write_meta(xmlTextWriterPtr writer, const char *name, const char *content) {
    int xml_ret = xmlTextWriterStartElement(writer, BAD_CAST "meta");
    if (xml_ret < 0) {
        debug_print("XML error: %i (name: %s, content: %s)\n", xml_ret, name, content);
        return MOBI_XML_ERR;
    }
    xml_ret = xmlTextWriterWriteAttribute(writer, BAD_CAST "name", BAD_CAST name);
    if (xml_ret < 0) {
        debug_print("XML error: %i (name: %s, content: %s)\n", xml_ret, name, content);
        return MOBI_XML_ERR;
    }
    xml_ret = xmlTextWriterWriteAttribute(writer, BAD_CAST "content", BAD_CAST content);
    if (xml_ret < 0) {
        debug_print("XML error: %i (name: %s, content: %s)\n", xml_ret, name, content);
        return MOBI_XML_ERR;
    }
    xml_ret = xmlTextWriterEndElement(writer);
    if (xml_ret < 0) {
        debug_print("XML error: %i (name: %s, content: %s)\n", xml_ret, name, content);
        return MOBI_XML_ERR;
    }
    return MOBI_SUCCESS;
}
MOBI_RET mobi_xml_write_meta(xmlTextWriterPtr writer, const char *name, const char *content) {
    int xml_ret = xmlTextWriterStartElement(writer, BAD_CAST "meta");
    if (xml_ret < 0) {
        debug_print("XML error: %i (name: %s, content: %s)\n", xml_ret, name, content);
        return MOBI_XML_ERR;
    }
    xml_ret = xmlTextWriterWriteAttribute(writer, BAD_CAST "name", BAD_CAST name);
    if (xml_ret < 0) {
        debug_print("XML error: %i (name: %s, content: %s)\n", xml_ret, name, content);
        return MOBI_XML_ERR;
    }
    xml_ret = xmlTextWriterWriteAttribute(writer, BAD_CAST "content", BAD_CAST content);
    if (xml_ret < 0) {
        debug_print("XML error: %i (name: %s, content: %s)\n", xml_ret, name, content);
        return MOBI_XML_ERR;
    }
    xml_ret = xmlTextWriterEndElement(writer);
    if (xml_ret < 0) {
        debug_print("XML error: %i (name: %s, content: %s)\n", xml_ret, name, content);
        return MOBI_XML_ERR;
    }
    return MOBI_SUCCESS;
}