summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--parser.c31
2 files changed, 24 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 49887ecd..c1e7119f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Nov 29 17:10:22 CET 2001 Daniel Veillard <daniel@veillard.com>
+
+ * parser.c: Robin Berjon <robin@knowscape.com> found a case
+ where non-wellformed XML declaractions were not detected.
+
Wed Nov 28 15:41:40 CET 2001 Daniel Veillard <daniel@veillard.com>
* xpointer.c: fixed a compilation bug pointed by Danny Jamshy
diff --git a/parser.c b/parser.c
index dde6d128..16a54230 100644
--- a/parser.c
+++ b/parser.c
@@ -7316,21 +7316,28 @@ xmlParseXMLDecl(xmlParserCtxtPtr ctxt) {
SKIP_BLANKS;
/*
- * We should have the VersionInfo here.
+ * We must have the VersionInfo here.
*/
version = xmlParseVersionInfo(ctxt);
- if (version == NULL)
- version = xmlCharStrdup(XML_DEFAULT_VERSION);
- else if (!xmlStrEqual(version, (const xmlChar *) XML_DEFAULT_VERSION)) {
- /*
- * TODO: Blueberry should be detected here
- */
- if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt->userData, "Unsupported version '%s'\n",
- version);
+ if (version == NULL) {
+ if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
+ ctxt->sax->error(ctxt->userData,
+ "Malformed declaration expecting version\n");
+ ctxt->wellFormed = 0;
+ ctxt->disableSAX = 1;
+ } else {
+ if (!xmlStrEqual(version, (const xmlChar *) XML_DEFAULT_VERSION)) {
+ /*
+ * TODO: Blueberry should be detected here
+ */
+ if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
+ ctxt->sax->warning(ctxt->userData, "Unsupported version '%s'\n",
+ version);
+ }
+ if (ctxt->version != NULL)
+ xmlFree(ctxt->version);
+ ctxt->version = version;
}
- ctxt->version = xmlStrdup(version);
- xmlFree(version);
/*
* We may have the encoding declaration