diff --git a/xmllint.c b/xmllint.c index 0f319c75d4cc9864b42b8808e0d341bdb141e4b2_eG1sbGludC5j..a394f13ada7fea2651b24d49b463a47a59f70390_eG1sbGludC5j 100644 --- a/xmllint.c +++ b/xmllint.c @@ -112,4 +112,5 @@ static int noblanks = 0; static int noout = 0; static int nowrap = 0; +static int format = 0; #ifdef LIBXML_OUTPUT_ENABLED @@ -115,5 +116,4 @@ #ifdef LIBXML_OUTPUT_ENABLED -static int format = 0; static const char *output = NULL; static int compress = 0; static int oldout = 0; @@ -2336,10 +2336,5 @@ } else { if (rectxt != NULL) doc = xmlCtxtReadFile(rectxt, filename, NULL, options); - else { -#ifdef LIBXML_SAX1_ENABLED - if (sax1) - doc = xmlParseFile(filename); - else -#endif /* LIBXML_SAX1_ENABLED */ + else doc = xmlReadFile(filename, NULL, options); @@ -2345,5 +2340,4 @@ doc = xmlReadFile(filename, NULL, options); - } } } @@ -3143,8 +3137,7 @@ options |= XML_PARSE_HUGE; } else if ((!strcmp(argv[i], "-noent")) || (!strcmp(argv[i], "--noent"))) { - noent++; - options |= XML_PARSE_NOENT; + noent = 1; } else if ((!strcmp(argv[i], "-noenc")) || (!strcmp(argv[i], "--noenc"))) { noenc++; @@ -3297,6 +3290,4 @@ #endif /* LIBXML_OUTPUT_ENABLED */ else if ((!strcmp(argv[i], "-nowarning")) || (!strcmp(argv[i], "--nowarning"))) { - xmlGetWarningsDefaultValue = 0; - xmlPedanticParserDefault(0); options |= XML_PARSE_NOWARNING; @@ -3302,4 +3293,5 @@ options |= XML_PARSE_NOWARNING; + options &= ~XML_PARSE_PEDANTIC; } else if ((!strcmp(argv[i], "-pedantic")) || (!strcmp(argv[i], "--pedantic"))) { @@ -3303,6 +3295,4 @@ } else if ((!strcmp(argv[i], "-pedantic")) || (!strcmp(argv[i], "--pedantic"))) { - xmlGetWarningsDefaultValue = 1; - xmlPedanticParserDefault(1); options |= XML_PARSE_PEDANTIC; @@ -3308,4 +3298,5 @@ options |= XML_PARSE_PEDANTIC; + options &= XML_PARSE_NOWARNING; } #ifdef LIBXML_DEBUG_ENABLED else if ((!strcmp(argv[i], "-debugent")) || @@ -3351,9 +3342,7 @@ } else if ((!strcmp(argv[i], "-noblanks")) || (!strcmp(argv[i], "--noblanks"))) { - noblanks++; - xmlKeepBlanksDefault(0); - options |= XML_PARSE_NOBLANKS; + noblanks = 1; } else if ((!strcmp(argv[i], "-maxmem")) || (!strcmp(argv[i], "--maxmem"))) { @@ -3361,5 +3350,4 @@ } else if ((!strcmp(argv[i], "-format")) || (!strcmp(argv[i], "--format"))) { - noblanks++; #ifdef LIBXML_OUTPUT_ENABLED @@ -3365,3 +3353,3 @@ #ifdef LIBXML_OUTPUT_ENABLED - format = 1; + format = 1; #endif /* LIBXML_OUTPUT_ENABLED */ @@ -3367,5 +3355,4 @@ #endif /* LIBXML_OUTPUT_ENABLED */ - xmlKeepBlanksDefault(0); } else if ((!strcmp(argv[i], "-pretty")) || (!strcmp(argv[i], "--pretty"))) { @@ -3369,5 +3356,5 @@ } else if ((!strcmp(argv[i], "-pretty")) || (!strcmp(argv[i], "--pretty"))) { - i++; + i++; #ifdef LIBXML_OUTPUT_ENABLED @@ -3373,11 +3360,6 @@ #ifdef LIBXML_OUTPUT_ENABLED - if (argv[i] != NULL) { - format = atoi(argv[i]); - if (format == 1) { - noblanks++; - xmlKeepBlanksDefault(0); - } - } + if (argv[i] != NULL) + format = atoi(argv[i]); #endif /* LIBXML_OUTPUT_ENABLED */ } #ifdef LIBXML_READER_ENABLED @@ -3416,9 +3398,8 @@ (!strcmp(argv[i], "--relaxng"))) { i++; relaxng = argv[i]; - noent++; - options |= XML_PARSE_NOENT; + noent = 1; } else if ((!strcmp(argv[i], "-schema")) || (!strcmp(argv[i], "--schema"))) { i++; schema = argv[i]; @@ -3421,11 +3402,11 @@ } else if ((!strcmp(argv[i], "-schema")) || (!strcmp(argv[i], "--schema"))) { i++; schema = argv[i]; - noent++; + noent = 1; #endif #ifdef LIBXML_SCHEMATRON_ENABLED } else if ((!strcmp(argv[i], "-schematron")) || (!strcmp(argv[i], "--schematron"))) { i++; schematron = argv[i]; @@ -3426,10 +3407,10 @@ #endif #ifdef LIBXML_SCHEMATRON_ENABLED } else if ((!strcmp(argv[i], "-schematron")) || (!strcmp(argv[i], "--schematron"))) { i++; schematron = argv[i]; - noent++; + noent = 1; #endif } else if ((!strcmp(argv[i], "-nonet")) || (!strcmp(argv[i], "--nonet"))) { @@ -3492,8 +3473,7 @@ defaultEntityLoader = xmlGetExternalEntityLoader(); xmlSetExternalEntityLoader(xmllintExternalEntityLoader); - xmlLineNumbersDefault(1); if (loaddtd != 0) xmlLoadExtDtdDefaultValue |= XML_DETECT_IDS; if (dtdattrs) xmlLoadExtDtdDefaultValue |= XML_COMPLETE_ATTRS; @@ -3496,11 +3476,11 @@ if (loaddtd != 0) xmlLoadExtDtdDefaultValue |= XML_DETECT_IDS; if (dtdattrs) xmlLoadExtDtdDefaultValue |= XML_COMPLETE_ATTRS; - if (noent != 0) xmlSubstituteEntitiesDefault(1); -#ifdef LIBXML_VALID_ENABLED - if (valid != 0) xmlDoValidityCheckingDefaultValue = 1; -#endif /* LIBXML_VALID_ENABLED */ + if (noent != 0) + options |= XML_PARSE_NOENT; + if ((noblanks != 0) || (format == 1)) + options |= XML_PARSE_NOBLANKS; if ((htmlout) && (!nowrap)) { xmlGenericError(xmlGenericErrorContext, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"\n");