Commit 87247e87 authored by Daniel Veillard's avatar Daniel Veillard
Browse files

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
parent c82c57e6
Tue Jan 13 21:39:58 CET 2004 Daniel Veillard <daniel@veillard.com>
* 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 <daniel@veillard.com>
 
* dict.c parser.c xmlstring.c: some parser optimizations,
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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,
......
......@@ -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]);
......
......@@ -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]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment