struct oscap_source *xccdf_benchmark_export_source(struct xccdf_benchmark *benchmark, const char *filename) { xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0"); if (doc == NULL) { oscap_setxmlerr(xmlGetLastError()); return NULL; } xccdf_benchmark_to_dom(benchmark, doc, NULL, NULL); return oscap_source_new_from_xmlDoc(doc, filename); }
int xccdf_benchmark_export(struct xccdf_benchmark *benchmark, const char *file) { __attribute__nonnull__(file); LIBXML_TEST_VERSION; xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0"); if (doc == NULL) { oscap_setxmlerr(xmlGetLastError()); return -1; } xccdf_benchmark_to_dom(benchmark, doc, NULL, NULL); return oscap_xml_save_filename(file, doc); }