libxml2 r3782 - in trunk: . include/libxml
- From: veillard svn gnome org
- To: svn-commits-list gnome org
- Subject: libxml2 r3782 - in trunk: . include/libxml
- Date: Wed, 27 Aug 2008 19:57:07 +0000 (UTC)
Author: veillard
Date: Wed Aug 27 19:57:06 2008
New Revision: 3782
URL: http://svn.gnome.org/viewvc/libxml2?rev=3782&view=rev
Log:
* include/libxml/xmlerror.h parser.c: a bit of cleanup and
added checks based on the regression tests of the xmlconf suite
Daniel
Modified:
trunk/ChangeLog
trunk/include/libxml/xmlerror.h
trunk/parser.c
Modified: trunk/include/libxml/xmlerror.h
==============================================================================
--- trunk/include/libxml/xmlerror.h (original)
+++ trunk/include/libxml/xmlerror.h Wed Aug 27 19:57:06 2008
@@ -252,6 +252,7 @@
XML_DTD_STANDALONE_DEFAULTED, /* 538 */
XML_DTD_XMLID_VALUE, /* 539 */
XML_DTD_XMLID_TYPE, /* 540 */
+ XML_DTD_DUP_TOKEN, /* 541 */
XML_HTML_STRUCURE_ERROR = 800,
XML_HTML_UNKNOWN_TAG, /* 801 */
XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000,
Modified: trunk/parser.c
==============================================================================
--- trunk/parser.c (original)
+++ trunk/parser.c Wed Aug 27 19:57:06 2008
@@ -5209,7 +5209,7 @@
xmlEnumerationPtr
xmlParseNotationType(xmlParserCtxtPtr ctxt) {
const xmlChar *name;
- xmlEnumerationPtr ret = NULL, last = NULL, cur;
+ xmlEnumerationPtr ret = NULL, last = NULL, cur, tmp;
if (RAW != '(') {
xmlFatalErr(ctxt, XML_ERR_NOTATION_NOT_STARTED, NULL);
@@ -5225,12 +5225,26 @@
"Name expected in NOTATION declaration\n");
return(ret);
}
- cur = xmlCreateEnumeration(name);
- if (cur == NULL) return(ret);
- if (last == NULL) ret = last = cur;
- else {
- last->next = cur;
- last = cur;
+ tmp = ret;
+ while (tmp != NULL) {
+ if (xmlStrEqual(name, tmp->name)) {
+ xmlValidityError(ctxt, XML_DTD_DUP_TOKEN,
+ "standalone: attribute notation value token %s duplicated\n",
+ name, NULL);
+ if (!xmlDictOwns(ctxt->dict, name))
+ xmlFree((xmlChar *) name);
+ break;
+ }
+ tmp = tmp->next;
+ }
+ if (tmp == NULL) {
+ cur = xmlCreateEnumeration(name);
+ if (cur == NULL) return(ret);
+ if (last == NULL) ret = last = cur;
+ else {
+ last->next = cur;
+ last = cur;
+ }
}
SKIP_BLANKS;
} while (RAW == '|');
@@ -5262,7 +5276,7 @@
xmlEnumerationPtr
xmlParseEnumerationType(xmlParserCtxtPtr ctxt) {
xmlChar *name;
- xmlEnumerationPtr ret = NULL, last = NULL, cur;
+ xmlEnumerationPtr ret = NULL, last = NULL, cur, tmp;
if (RAW != '(') {
xmlFatalErr(ctxt, XML_ERR_ATTLIST_NOT_STARTED, NULL);
@@ -5277,13 +5291,28 @@
xmlFatalErr(ctxt, XML_ERR_NMTOKEN_REQUIRED, NULL);
return(ret);
}
- cur = xmlCreateEnumeration(name);
- xmlFree(name);
- if (cur == NULL) return(ret);
- if (last == NULL) ret = last = cur;
- else {
- last->next = cur;
- last = cur;
+ tmp = ret;
+ while (tmp != NULL) {
+ if (xmlStrEqual(name, tmp->name)) {
+ xmlValidityError(ctxt, XML_DTD_DUP_TOKEN,
+ "standalone: attribute enumeration value token %s duplicated\n",
+ name, NULL);
+ if (!xmlDictOwns(ctxt->dict, name))
+ xmlFree(name);
+ break;
+ }
+ tmp = tmp->next;
+ }
+ if (tmp == NULL) {
+ cur = xmlCreateEnumeration(name);
+ if (!xmlDictOwns(ctxt->dict, name))
+ xmlFree(name);
+ if (cur == NULL) return(ret);
+ if (last == NULL) ret = last = cur;
+ else {
+ last->next = cur;
+ last = cur;
+ }
}
SKIP_BLANKS;
} while (RAW == '|');
@@ -5530,8 +5559,9 @@
}
if (RAW == '>') {
if (input != ctxt->input) {
- xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
- "Attribute list declaration doesn't start and stop in the same entity\n");
+ xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
+ "Attribute list declaration doesn't start and stop in the same entity\n",
+ NULL, NULL);
}
NEXT;
}
@@ -6103,6 +6133,8 @@
static void
xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
+ int id = ctxt->input->id;
+
SKIP(3);
SKIP_BLANKS;
if (CMP7(CUR_PTR, 'I', 'N', 'C', 'L', 'U', 'D', 'E')) {
@@ -6111,6 +6143,11 @@
if (RAW != '[') {
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
} else {
+ if (ctxt->input->id != id) {
+ xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
+ "All markup of the conditional section is not in the same entity\n",
+ NULL, NULL);
+ }
NEXT;
}
if (xmlParserDebugEntities) {
@@ -6166,6 +6203,11 @@
if (RAW != '[') {
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
} else {
+ if (ctxt->input->id != id) {
+ xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
+ "All markup of the conditional section is not in the same entity\n",
+ NULL, NULL);
+ }
NEXT;
}
if (xmlParserDebugEntities) {
@@ -6222,6 +6264,11 @@
if (RAW == 0) {
xmlFatalErr(ctxt, XML_ERR_CONDSEC_NOT_FINISHED, NULL);
} else {
+ if (ctxt->input->id != id) {
+ xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
+ "All markup of the conditional section is not in the same entity\n",
+ NULL, NULL);
+ }
SKIP(3);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]