mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
- parser.c: Fixed bug on invalid ontent characters and when using
push. - xmllint.c: fixed xmllint endling of errors in push mode Daniel
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
Tue Aug 29 20:22:53 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||||
|
|
||||||
|
* parser.c: Fixed bug on invalid ontent characters and when using
|
||||||
|
push.
|
||||||
|
* xmllint.c: fixed xmllint endling of errors in push mode
|
||||||
|
|
||||||
Tue Aug 29 11:24:48 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
Tue Aug 29 11:24:48 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||||
|
|
||||||
* HTMLparser.c testHTML.c: applied two new patches from
|
* HTMLparser.c testHTML.c: applied two new patches from
|
||||||
|
23
parser.c
23
parser.c
@ -8597,6 +8597,7 @@ xmlParseContent(xmlParserCtxtPtr ctxt) {
|
|||||||
ctxt->errNo = XML_ERR_INTERNAL_ERROR;
|
ctxt->errNo = XML_ERR_INTERNAL_ERROR;
|
||||||
ctxt->wellFormed = 0;
|
ctxt->wellFormed = 0;
|
||||||
ctxt->disableSAX = 1;
|
ctxt->disableSAX = 1;
|
||||||
|
ctxt->instate = XML_PARSER_EOF;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9982,7 +9983,11 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case XML_PARSER_CONTENT:
|
case XML_PARSER_CONTENT: {
|
||||||
|
const xmlChar *test;
|
||||||
|
int cons;
|
||||||
|
xmlChar tok;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle preparsed entities and charRef
|
* Handle preparsed entities and charRef
|
||||||
*/
|
*/
|
||||||
@ -9999,6 +10004,10 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
|||||||
goto done;
|
goto done;
|
||||||
cur = ctxt->input->cur[0];
|
cur = ctxt->input->cur[0];
|
||||||
next = ctxt->input->cur[1];
|
next = ctxt->input->cur[1];
|
||||||
|
|
||||||
|
test = CUR_PTR;
|
||||||
|
cons = ctxt->input->consumed;
|
||||||
|
tok = ctxt->token;
|
||||||
if ((cur == '<') && (next == '?')) {
|
if ((cur == '<') && (next == '?')) {
|
||||||
if ((!terminate) &&
|
if ((!terminate) &&
|
||||||
(xmlParseLookupSequence(ctxt, '?', '>', 0) < 0))
|
(xmlParseLookupSequence(ctxt, '?', '>', 0) < 0))
|
||||||
@ -10082,7 +10091,19 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
|||||||
*/
|
*/
|
||||||
while ((RAW == 0) && (ctxt->inputNr > 1))
|
while ((RAW == 0) && (ctxt->inputNr > 1))
|
||||||
xmlPopInput(ctxt);
|
xmlPopInput(ctxt);
|
||||||
|
if ((cons == ctxt->input->consumed) && (test == CUR_PTR) &&
|
||||||
|
(tok == ctxt->token)) {
|
||||||
|
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
||||||
|
ctxt->sax->error(ctxt->userData,
|
||||||
|
"detected an error in element content\n");
|
||||||
|
ctxt->errNo = XML_ERR_INTERNAL_ERROR;
|
||||||
|
ctxt->wellFormed = 0;
|
||||||
|
ctxt->disableSAX = 1;
|
||||||
|
ctxt->instate = XML_PARSER_EOF;
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case XML_PARSER_CDATA_SECTION: {
|
case XML_PARSER_CDATA_SECTION: {
|
||||||
/*
|
/*
|
||||||
* The Push mode need to have the SAX callback for
|
* The Push mode need to have the SAX callback for
|
||||||
|
@ -382,6 +382,7 @@ void parseAndPrintFile(char *filename) {
|
|||||||
|
|
||||||
f = fopen(filename, "r");
|
f = fopen(filename, "r");
|
||||||
if (f != NULL) {
|
if (f != NULL) {
|
||||||
|
int ret;
|
||||||
int res, size = 3;
|
int res, size = 3;
|
||||||
char chars[1024];
|
char chars[1024];
|
||||||
xmlParserCtxtPtr ctxt;
|
xmlParserCtxtPtr ctxt;
|
||||||
@ -397,7 +398,12 @@ void parseAndPrintFile(char *filename) {
|
|||||||
}
|
}
|
||||||
xmlParseChunk(ctxt, chars, 0, 1);
|
xmlParseChunk(ctxt, chars, 0, 1);
|
||||||
doc = ctxt->myDoc;
|
doc = ctxt->myDoc;
|
||||||
|
ret = ctxt->wellFormed;
|
||||||
xmlFreeParserCtxt(ctxt);
|
xmlFreeParserCtxt(ctxt);
|
||||||
|
if (!ret) {
|
||||||
|
xmlFreeDoc(doc);
|
||||||
|
doc = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (testIO) {
|
} else if (testIO) {
|
||||||
|
Reference in New Issue
Block a user