From 87247e87408561aee625b2e800ea3c13211af897 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Tue, 13 Jan 2004 20:42:02 +0000 Subject: [PATCH] applied patch from Mark Vadoc to not use SAX1 unless necessary. Daniel * HTMLparser.c relaxng.c testRelax.c testSchemas.c: applied patch from Mark Vadoc to not use SAX1 unless necessary. Daniel --- ChangeLog | 5 +++++ HTMLparser.c | 2 ++ doc/examples/xpath1.c | 6 +++--- relaxng.c | 8 ++++---- testRelax.c | 2 +- testSchemas.c | 2 +- 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 37fbdb17..08d7c69c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Jan 13 21:39:58 CET 2004 Daniel Veillard + + * HTMLparser.c relaxng.c testRelax.c testSchemas.c: applied + patch from Mark Vadoc to not use SAX1 unless necessary. + Mon Jan 12 17:22:57 CET 2004 Daniel Veillard * dict.c parser.c xmlstring.c: some parser optimizations, diff --git a/HTMLparser.c b/HTMLparser.c index a2d76166..7c0d32aa 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -5173,9 +5173,11 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding) } canonicFilename = (char *) xmlCanonicPath((const xmlChar *) filename); if (canonicFilename == NULL) { +#ifdef LIBXML_SAX1_ENABLED if (xmlDefaultSAXHandler.error != NULL) { xmlDefaultSAXHandler.error(NULL, "out of memory\n"); } +#endif xmlFreeParserCtxt(ctxt); return(NULL); } diff --git a/doc/examples/xpath1.c b/doc/examples/xpath1.c index 8bc10fcc..f6e939bb 100644 --- a/doc/examples/xpath1.c +++ b/doc/examples/xpath1.c @@ -162,7 +162,7 @@ register_namespaces(xmlXPathContextPtr xpathCtx, const xmlChar* nsList) { next = (xmlChar*)xmlStrchr(next, '='); if(next == NULL) { fprintf(stderr,"Error: invalid namespaces list format\n"); - free(nsListDup); + xmlFree(nsListDup); return(-1); } *(next++) = '\0'; @@ -177,12 +177,12 @@ register_namespaces(xmlXPathContextPtr xpathCtx, const xmlChar* nsList) { /* do register namespace */ if(xmlXPathRegisterNs(xpathCtx, prefix, href) != 0) { fprintf(stderr,"Error: unable to register NS with prefix=\"%s\" and href=\"%s\"\n", prefix, href); - free(nsListDup); + xmlFree(nsListDup); return(-1); } } - free(nsListDup); + xmlFree(nsListDup); return(0); } diff --git a/relaxng.c b/relaxng.c index e1def1c6..985eff27 100644 --- a/relaxng.c +++ b/relaxng.c @@ -1569,7 +1569,7 @@ xmlRelaxNGLoadInclude(xmlRelaxNGParserCtxtPtr ctxt, const xmlChar * URL, /* * load the document */ - doc = xmlParseFile((const char *) URL); + doc = xmlReadFile((const char *) URL,NULL,0); if (doc == NULL) { xmlRngPErr(ctxt, node, XML_RNGP_PARSE_ERROR, "xmlRelaxNG: could not load %s\n", URL, NULL); @@ -1901,7 +1901,7 @@ xmlRelaxNGLoadExternalRef(xmlRelaxNGParserCtxtPtr ctxt, /* * load the document */ - doc = xmlParseFile((const char *) URL); + doc = xmlReadFile((const char *) URL,NULL,0); if (doc == NULL) { xmlRngPErr(ctxt, NULL, XML_RNGP_PARSE_ERROR, "xmlRelaxNG: could not load %s\n", URL, NULL); @@ -7240,7 +7240,7 @@ xmlRelaxNGParse(xmlRelaxNGParserCtxtPtr ctxt) * First step is to parse the input document into an DOM/Infoset */ if (ctxt->URL != NULL) { - doc = xmlParseFile((const char *) ctxt->URL); + doc = xmlReadFile((const char *) ctxt->URL,NULL,0); if (doc == NULL) { xmlRngPErr(ctxt, NULL, XML_RNGP_PARSE_ERROR, "xmlRelaxNGParse: could not load %s\n", ctxt->URL, @@ -7248,7 +7248,7 @@ xmlRelaxNGParse(xmlRelaxNGParserCtxtPtr ctxt) return (NULL); } } else if (ctxt->buffer != NULL) { - doc = xmlParseMemory(ctxt->buffer, ctxt->size); + doc = xmlReadMemory(ctxt->buffer, ctxt->size,NULL,NULL,0); if (doc == NULL) { xmlRngPErr(ctxt, NULL, XML_RNGP_PARSE_ERROR, "xmlRelaxNGParse: could not parse schemas\n", NULL, diff --git a/testRelax.c b/testRelax.c index dee47156..e18b3c2f 100644 --- a/testRelax.c +++ b/testRelax.c @@ -134,7 +134,7 @@ int main(int argc, char **argv) { } else { xmlDocPtr doc; - doc = xmlParseFile(argv[i]); + doc = xmlReadFile(argv[i],NULL,0); if (doc == NULL) { fprintf(stderr, "Could not parse %s\n", argv[i]); diff --git a/testSchemas.c b/testSchemas.c index de12e259..47f8b39a 100644 --- a/testSchemas.c +++ b/testSchemas.c @@ -125,7 +125,7 @@ int main(int argc, char **argv) { } else { xmlDocPtr doc; - doc = xmlParseFile(argv[i]); + doc = xmlReadFile(argv[i],NULL,0); if (doc == NULL) { fprintf(stderr, "Could not parse %s\n", argv[i]);