| 35 | |
| 36 | |
| 37 | int xml_save(RIG *rig, const char *outfilename) |
| 38 | { |
| 39 | #ifdef HAVE_XML2 |
| 40 | int retval; |
| 41 | xmlDocPtr Doc; |
| 42 | xmlNodePtr root; |
| 43 | |
| 44 | /* create xlm Doc */ |
| 45 | Doc = xmlNewDoc((unsigned char *) "1.0"); |
| 46 | root = xmlNewNode(NULL, (unsigned char *) "hamlib"); |
| 47 | xmlDocSetRootElement(Doc, root); |
| 48 | root = xmlNewChild(root, NULL, (unsigned char *) "channels", NULL); |
| 49 | |
| 50 | |
| 51 | if (rig->caps->clone_combo_get) |
| 52 | printf("About to save data, enter cloning mode: %s\n", |
| 53 | rig->caps->clone_combo_get); |
| 54 | |
| 55 | retval = rig_get_chan_all_cb(rig, RIG_VFO_NONE, dump_xml_chan, root); |
| 56 | |
| 57 | if (retval != RIG_OK) |
| 58 | { |
| 59 | return retval; |
| 60 | } |
| 61 | |
| 62 | /* write xml File */ |
| 63 | |
| 64 | xmlSaveFormatFileEnc(outfilename, Doc, "UTF-8", 1); |
| 65 | |
| 66 | xmlFreeDoc(Doc); |
| 67 | xmlCleanupParser(); |
| 68 | |
| 69 | return 0; |
| 70 | #else |
| 71 | return -RIG_ENAVAIL; |
| 72 | #endif |
| 73 | } |
| 74 | |
| 75 | |
| 76 | int xml_parm_save(RIG *rig, const char *outfilename) |
no test coverage detected