struct iio_context * xml_create_context_mem(const char *xml, size_t len) { struct iio_context *ctx; xmlDoc *doc; LIBXML_TEST_VERSION; doc = xmlReadMemory(xml, (int) len, NULL, NULL, XML_PARSE_DTDVALID); if (!doc) { ERROR("Unable to parse XML file\n"); return NULL; } ctx = iio_create_xml_context_helper(doc); xmlFreeDoc(doc); xmlCleanupParser(); return ctx; }
struct iio_context * xml_create_context(const char *xml_file) { struct iio_context *ctx; xmlDoc *doc; LIBXML_TEST_VERSION; doc = xmlReadFile(xml_file, NULL, XML_PARSE_DTDVALID); if (!doc) { ERROR("Unable to parse XML file\n"); errno = EINVAL; return NULL; } ctx = iio_create_xml_context_helper(doc); xmlFreeDoc(doc); return ctx; }