MCPcopy Create free account
hub / github.com/Kitware/VTK / c14nRunTest

Function c14nRunTest

ThirdParty/libxml2/vtklibxml2/runtest.c:3993–4079  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3991}
3992
3993static int
3994c14nRunTest(const char* xml_filename, int with_comments, int mode,
3995 const char* xpath_filename, const char *ns_filename,
3996 const char* result_file) {
3997 xmlDocPtr doc;
3998 xmlXPathObjectPtr xpath = NULL;
3999 xmlChar *result = NULL;
4000 int ret;
4001 xmlChar **inclusive_namespaces = NULL;
4002 const char *nslist = NULL;
4003 int nssize;
4004
4005
4006 /*
4007 * build an XML tree from a the file; we need to add default
4008 * attributes and resolve all character and entities references
4009 */
4010 doc = xmlReadFile(xml_filename, NULL,
4011 XML_PARSE_DTDATTR | XML_PARSE_NOENT | XML_PARSE_NOWARNING);
4012 if (doc == NULL) {
4013 fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_filename);
4014 return(-1);
4015 }
4016
4017 /*
4018 * Check the document is of the right kind
4019 */
4020 if(xmlDocGetRootElement(doc) == NULL) {
4021 fprintf(stderr,"Error: empty document for file \"%s\"\n", xml_filename);
4022 xmlFreeDoc(doc);
4023 return(-1);
4024 }
4025
4026 /*
4027 * load xpath file if specified
4028 */
4029 if(xpath_filename) {
4030 xpath = load_xpath_expr(doc, xpath_filename);
4031 if(xpath == NULL) {
4032 fprintf(stderr,"Error: unable to evaluate xpath expression\n");
4033 xmlFreeDoc(doc);
4034 return(-1);
4035 }
4036 }
4037
4038 if (ns_filename != NULL) {
4039 if (loadMem(ns_filename, &nslist, &nssize)) {
4040 fprintf(stderr,"Error: unable to evaluate xpath expression\n");
4041 if(xpath != NULL) xmlXPathFreeObject(xpath);
4042 xmlFreeDoc(doc);
4043 return(-1);
4044 }
4045 inclusive_namespaces = parse_list((xmlChar *) nslist);
4046 }
4047
4048 /*
4049 * Canonical form
4050 */

Callers 1

c14nCommonTestFunction · 0.85

Calls 10

xmlReadFileFunction · 0.85
fprintfFunction · 0.85
xmlDocGetRootElementFunction · 0.85
xmlFreeDocFunction · 0.85
load_xpath_exprFunction · 0.85
loadMemFunction · 0.85
xmlXPathFreeObjectFunction · 0.85
parse_listFunction · 0.85
xmlC14NDocDumpMemoryFunction · 0.85
compareFileMemFunction · 0.85

Tested by

no test coverage detected