Skip to content

Commit

Permalink
applied patch from Mark Vadoc to not use SAX1 unless necessary. Daniel
Browse files Browse the repository at this point in the history
* HTMLparser.c relaxng.c testRelax.c testSchemas.c: applied
  patch from Mark Vadoc to not use SAX1 unless necessary.
Daniel
  • Loading branch information
Daniel Veillard committed Jan 13, 2004
1 parent c82c57e commit 87247e8
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Tue Jan 13 21:39:58 CET 2004 Daniel Veillard <[email protected]>

* 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 <[email protected]>

* dict.c parser.c xmlstring.c: some parser optimizations,
Expand Down
2 changes: 2 additions & 0 deletions HTMLparser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 3 additions & 3 deletions doc/examples/xpath1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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);
}

Expand Down
8 changes: 4 additions & 4 deletions relaxng.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -7240,15 +7240,15 @@ 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,
NULL);
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,
Expand Down
2 changes: 1 addition & 1 deletion testRelax.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion testSchemas.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit 87247e8

Please sign in to comment.