- parser.c: Fixed bug on invalid ontent characters and when using
push.
- xmllint.c: fixed xmllint endling of errors in push mode
Daniel
diff --git a/ChangeLog b/ChangeLog
index 38a1fba..c156f19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* HTMLparser.c testHTML.c: applied two new patches from
diff --git a/parser.c b/parser.c
index dd9b98f..1cc980e 100644
--- a/parser.c
+++ b/parser.c
@@ -8597,6 +8597,7 @@
ctxt->errNo = XML_ERR_INTERNAL_ERROR;
ctxt->wellFormed = 0;
ctxt->disableSAX = 1;
+ ctxt->instate = XML_PARSER_EOF;
break;
}
}
@@ -9982,7 +9983,11 @@
#endif
break;
}
- case XML_PARSER_CONTENT:
+ case XML_PARSER_CONTENT: {
+ const xmlChar *test;
+ int cons;
+ xmlChar tok;
+
/*
* Handle preparsed entities and charRef
*/
@@ -9999,6 +10004,10 @@
goto done;
cur = ctxt->input->cur[0];
next = ctxt->input->cur[1];
+
+ test = CUR_PTR;
+ cons = ctxt->input->consumed;
+ tok = ctxt->token;
if ((cur == '<') && (next == '?')) {
if ((!terminate) &&
(xmlParseLookupSequence(ctxt, '?', '>', 0) < 0))
@@ -10082,7 +10091,19 @@
*/
while ((RAW == 0) && (ctxt->inputNr > 1))
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;
+ }
case XML_PARSER_CDATA_SECTION: {
/*
* The Push mode need to have the SAX callback for
diff --git a/xmllint.c b/xmllint.c
index f9d9684..bfa6010 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -382,6 +382,7 @@
f = fopen(filename, "r");
if (f != NULL) {
+ int ret;
int res, size = 3;
char chars[1024];
xmlParserCtxtPtr ctxt;
@@ -397,7 +398,12 @@
}
xmlParseChunk(ctxt, chars, 0, 1);
doc = ctxt->myDoc;
+ ret = ctxt->wellFormed;
xmlFreeParserCtxt(ctxt);
+ if (!ret) {
+ xmlFreeDoc(doc);
+ doc = NULL;
+ }
}
}
} else if (testIO) {