diff --git a/example/gjobread.c b/example/gjobread.c index d092c12c..926cab07 100644 --- a/example/gjobread.c +++ b/example/gjobread.c @@ -184,18 +184,11 @@ parseGjobFile(char *filename ATTRIBUTE_UNUSED) { xmlNsPtr ns; xmlNodePtr cur; -#ifdef LIBXML_SAX1_ENABLED /* * build an XML tree from a the file; */ - doc = xmlParseFile(filename); + doc = xmlReadFile(filename, NULL, XML_PARSE_NOBLANKS); if (doc == NULL) return(NULL); -#else - /* - * the library has been compiled without some of the old interfaces - */ - return(NULL); -#endif /* LIBXML_SAX1_ENABLED */ /* * Check the document is of the right kind @@ -291,7 +284,6 @@ int main(int argc, char **argv) { /* COMPAT: Do not generate nodes for formatting spaces */ LIBXML_TEST_VERSION - xmlKeepBlanksDefault(0); for (i = 1; i < argc ; i++) { cur = parseGjobFile(argv[i]); diff --git a/runsuite.c b/runsuite.c index 750df2a2..8a909ea5 100644 --- a/runsuite.c +++ b/runsuite.c @@ -201,9 +201,6 @@ static xmlXPathContextPtr ctxtXPath; static void initializeLibxml2(void) { - xmlGetWarningsDefaultValue = 0; - xmlPedanticParserDefault(0); - xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup); xmlInitParser(); xmlSetExternalEntityLoader(testExternalEntityLoader); diff --git a/runtest.c b/runtest.c index 20c991ea..0adc1d24 100644 --- a/runtest.c +++ b/runtest.c @@ -558,7 +558,6 @@ initializeLibxml2(void) { xmlMemStrdup = NULL; xmlInitParser(); xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup); - xmlPedanticParserDefault(0); xmlSetExternalEntityLoader(testExternalEntityLoader); xmlSetStructuredErrorFunc(NULL, testStructuredErrorHandler); #ifdef LIBXML_SCHEMAS_ENABLED @@ -4065,9 +4064,6 @@ load_xpath_expr (xmlDocPtr parent_doc, const char* filename) { /* * load XPath expr as a file */ - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; - xmlSubstituteEntitiesDefault(1); - doc = xmlReadFile(filename, NULL, XML_PARSE_DTDATTR | XML_PARSE_NOENT); if (doc == NULL) { fprintf(stderr, "Error: unable to parse file \"%s\"\n", filename); @@ -4216,9 +4212,6 @@ c14nRunTest(const char* xml_filename, int with_comments, int mode, * build an XML tree from a the file; we need to add default * attributes and resolve all character and entities references */ - xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; - xmlSubstituteEntitiesDefault(1); - doc = xmlReadFile(xml_filename, NULL, XML_PARSE_DTDATTR | XML_PARSE_NOENT); if (doc == NULL) { fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_filename); @@ -4391,13 +4384,6 @@ static xmlThreadParams threadParams[] = { static const unsigned int num_threads = sizeof(threadParams) / sizeof(threadParams[0]); -#ifndef xmlDoValidityCheckingDefaultValue -#error xmlDoValidityCheckingDefaultValue is not a macro -#endif -#ifndef xmlGenericErrorContext -#error xmlGenericErrorContext is not a macro -#endif - static void * thread_specific_data(void *private_data) { @@ -4406,43 +4392,13 @@ thread_specific_data(void *private_data) const char *filename = params->filename; int okay = 1; - if (!strcmp(filename, "test/threads/invalid.xml")) { - xmlDoValidityCheckingDefaultValue = 0; - xmlGenericErrorContext = stdout; - } else { - xmlDoValidityCheckingDefaultValue = 1; - xmlGenericErrorContext = stderr; - } -#ifdef LIBXML_SAX1_ENABLED - myDoc = xmlParseFile(filename); -#else - myDoc = xmlReadFile(filename, NULL, XML_WITH_CATALOG); -#endif + myDoc = xmlReadFile(filename, NULL, XML_PARSE_NOENT | XML_PARSE_DTDLOAD); if (myDoc) { xmlFreeDoc(myDoc); } else { printf("parse failed\n"); okay = 0; } - if (!strcmp(filename, "test/threads/invalid.xml")) { - if (xmlDoValidityCheckingDefaultValue != 0) { - printf("ValidityCheckingDefaultValue override failed\n"); - okay = 0; - } - if (xmlGenericErrorContext != stdout) { - printf("xmlGenericErrorContext override failed\n"); - okay = 0; - } - } else { - if (xmlDoValidityCheckingDefaultValue != 1) { - printf("ValidityCheckingDefaultValue override failed\n"); - okay = 0; - } - if (xmlGenericErrorContext != stderr) { - printf("xmlGenericErrorContext override failed\n"); - okay = 0; - } - } params->okay = okay; return(NULL); } diff --git a/runxmlconf.c b/runxmlconf.c index f440bdc1..0f827b9a 100644 --- a/runxmlconf.c +++ b/runxmlconf.c @@ -148,9 +148,6 @@ static xmlXPathContextPtr ctxtXPath; static void initializeLibxml2(void) { - xmlGetWarningsDefaultValue = 0; - xmlPedanticParserDefault(0); - xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup); xmlInitParser(); xmlSetExternalEntityLoader(testExternalEntityLoader); @@ -252,8 +249,10 @@ xmlconfTestNotNSWF(const char *id, const char *filename, int options) { nb_errors++; ret = 0; } else { - if ((xmlLastError.code == XML_ERR_OK) || - (xmlLastError.domain != XML_FROM_NAMESPACE)) { + xmlError *error = xmlGetLastError(); + + if ((error->code == XML_ERR_OK) || + (error->domain != XML_FROM_NAMESPACE)) { test_log("test %s : %s failed to detect namespace error\n", id, filename); nb_errors++; diff --git a/testThreads.c b/testThreads.c index 58b161bb..b84d797d 100644 --- a/testThreads.c +++ b/testThreads.c @@ -43,13 +43,6 @@ static xmlThreadParams threadParams[] = { static const unsigned int num_threads = sizeof(threadParams) / sizeof(threadParams[0]); -#ifndef xmlDoValidityCheckingDefaultValue -#error xmlDoValidityCheckingDefaultValue is not a macro -#endif -#ifndef xmlGenericErrorContext -#error xmlGenericErrorContext is not a macro -#endif - static void * thread_specific_data(void *private_data) { @@ -57,6 +50,7 @@ thread_specific_data(void *private_data) xmlThreadParams *params = (xmlThreadParams *) private_data; const char *filename = params->filename; int okay = 1; + int options = 0; if (xmlCheckThreadLocalStorage() != 0) { printf("xmlCheckThreadLocalStorage failed\n"); @@ -64,43 +58,16 @@ thread_specific_data(void *private_data) return(NULL); } - if (!strcmp(filename, "test/threads/invalid.xml")) { - xmlDoValidityCheckingDefaultValue = 0; - xmlGenericErrorContext = stdout; - } else { - xmlDoValidityCheckingDefaultValue = 1; - xmlGenericErrorContext = stderr; + if (strcmp(filename, "test/threads/invalid.xml") != 0) { + options |= XML_PARSE_DTDVALID; } -#ifdef LIBXML_SAX1_ENABLED - myDoc = xmlParseFile(filename); -#else - myDoc = xmlReadFile(filename, NULL, XML_WITH_CATALOG); -#endif + myDoc = xmlReadFile(filename, NULL, options); if (myDoc) { xmlFreeDoc(myDoc); } else { printf("parse failed\n"); okay = 0; } - if (!strcmp(filename, "test/threads/invalid.xml")) { - if (xmlDoValidityCheckingDefaultValue != 0) { - printf("ValidityCheckingDefaultValue override failed\n"); - okay = 0; - } - if (xmlGenericErrorContext != stdout) { - printf("xmlGenericErrorContext override failed\n"); - okay = 0; - } - } else { - if (xmlDoValidityCheckingDefaultValue != 1) { - printf("ValidityCheckingDefaultValue override failed\n"); - okay = 0; - } - if (xmlGenericErrorContext != stderr) { - printf("xmlGenericErrorContext override failed\n"); - okay = 0; - } - } params->okay = okay; return(NULL); } diff --git a/testlimits.c b/testlimits.c index 5400bd80..d90b06ba 100644 --- a/testlimits.c +++ b/testlimits.c @@ -659,9 +659,6 @@ testStructuredErrorHandler(void *ctx ATTRIBUTE_UNUSED, xmlErrorPtr err) { static void initializeLibxml2(void) { - xmlGetWarningsDefaultValue = 0; - xmlPedanticParserDefault(0); - xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup); xmlInitParser(); xmlSetExternalEntityLoader(testExternalEntityLoader); diff --git a/testrecurse.c b/testrecurse.c index 83953d62..7a023d7f 100644 --- a/testrecurse.c +++ b/testrecurse.c @@ -627,9 +627,6 @@ testStructuredErrorHandler(void *ctx ATTRIBUTE_UNUSED, xmlErrorPtr err) { static void initializeLibxml2(void) { - xmlGetWarningsDefaultValue = 0; - xmlPedanticParserDefault(0); - xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup); xmlInitParser(); xmlSetExternalEntityLoader(testExternalEntityLoader);