mirror of
https://github.com/GNOME/libxml2.git
synced 2025-05-07 20:39:30 +08:00
Revert "valid: Remove duplicate error messages when streaming"
This reverts commit cd220b93d8ffffd2fb7cac0ec792bebb7e082521. This commit broke the xmstarlet tests.
This commit is contained in:
parent
aa4ef7737b
commit
6896f478d4
@ -42,6 +42,9 @@ value
|
||||
"""{0}/781333.xml:4: element a: validity error : Element a content does not follow the DTD, expecting ( ..., got
|
||||
<a/>
|
||||
^
|
||||
{0}/781333.xml:5: element a: validity error : Element a content does not follow the DTD, Expecting more children
|
||||
|
||||
^
|
||||
""".format(dir_prefix),
|
||||
'cond_sect2':
|
||||
"""{0}/dtds/cond_sect2.dtd:15: parser error : All markup of the conditional section is not in the same entity
|
||||
|
@ -1,3 +1,6 @@
|
||||
./test/VC/ElementValid2:4: element p: validity error : No declaration for element p
|
||||
<doc><p/></doc>
|
||||
^
|
||||
./test/VC/ElementValid2:5: element p: validity error : No declaration for element p
|
||||
|
||||
^
|
||||
|
@ -1,3 +1,6 @@
|
||||
./test/VC/ElementValid3:4: element doc: validity error : Element doc was declared EMPTY this one has content
|
||||
<doc>Oops, this element was declared EMPTY</doc>
|
||||
^
|
||||
./test/VC/ElementValid3:5: element doc: validity error : Element doc was declared EMPTY this one has content
|
||||
|
||||
^
|
||||
|
@ -1,3 +1,6 @@
|
||||
./test/VC/ElementValid4:7: element doc: validity error : Element c is not declared in doc list of possible children
|
||||
<doc> This <b>seems</b> Ok <a/> but this <c>was not declared</c></doc>
|
||||
^
|
||||
./test/VC/ElementValid4:8: element doc: validity error : Element c is not declared in doc list of possible children
|
||||
|
||||
^
|
||||
|
@ -1,3 +1,9 @@
|
||||
./test/VC/ElementValid5:7: element doc: validity error : Element doc content does not follow the DTD, expecting (a , b* , c+), got (a b c b)
|
||||
<doc><a/><b> but this</b><c>was not declared</c><b>seems</b></doc>
|
||||
^
|
||||
./test/VC/ElementValid5:8: element doc: validity error : Element doc content does not follow the DTD, Misplaced b
|
||||
|
||||
^
|
||||
./test/VC/ElementValid5:8: element doc: validity error : Element doc content does not follow the DTD, Expecting more children
|
||||
|
||||
^
|
||||
|
@ -1,3 +1,6 @@
|
||||
./test/VC/ElementValid6:7: element doc: validity error : Element doc content does not follow the DTD, expecting (a , b? , c+)?, got (a b)
|
||||
<doc><a/><b>lacks c</b></doc>
|
||||
^
|
||||
./test/VC/ElementValid6:8: element doc: validity error : Element doc content does not follow the DTD, Expecting more children
|
||||
|
||||
^
|
||||
|
@ -1,3 +1,6 @@
|
||||
./test/VC/ElementValid7:7: element doc: validity error : Element doc content does not follow the DTD, expecting ((a | b)* , c+ , a , b? , c , a?), got (a b a c c a)
|
||||
<doc><a/><b/><a/><c/><c/><a/></doc>
|
||||
^
|
||||
./test/VC/ElementValid7:8: element doc: validity error : Element doc content does not follow the DTD, Expecting more children
|
||||
|
||||
^
|
||||
|
@ -1,3 +1,6 @@
|
||||
./test/valid/781333.xml:4: element a: validity error : Element a content does not follow the DTD, expecting ( ..., got
|
||||
<a/>
|
||||
^
|
||||
./test/valid/781333.xml:5: element a: validity error : Element a content does not follow the DTD, Expecting more children
|
||||
|
||||
^
|
||||
|
40
valid.c
40
valid.c
@ -5554,6 +5554,12 @@ xmlValidGetElemDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
|
||||
*extsubset = 1;
|
||||
}
|
||||
}
|
||||
if (elemDecl == NULL) {
|
||||
xmlErrValidNode(ctxt, elem,
|
||||
XML_DTD_UNKNOWN_ELEM,
|
||||
"No declaration for element %s\n",
|
||||
elem->name, NULL, NULL);
|
||||
}
|
||||
return(elemDecl);
|
||||
}
|
||||
|
||||
@ -5596,6 +5602,10 @@ xmlValidatePushElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
|
||||
ret = 0;
|
||||
break;
|
||||
case XML_ELEMENT_TYPE_EMPTY:
|
||||
xmlErrValidNode(ctxt, state->node,
|
||||
XML_DTD_NOT_EMPTY,
|
||||
"Element %s was declared EMPTY this one has content\n",
|
||||
state->node->name, NULL, NULL);
|
||||
ret = 0;
|
||||
break;
|
||||
case XML_ELEMENT_TYPE_ANY:
|
||||
@ -5606,10 +5616,20 @@ xmlValidatePushElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
|
||||
if ((elemDecl->content != NULL) &&
|
||||
(elemDecl->content->type ==
|
||||
XML_ELEMENT_CONTENT_PCDATA)) {
|
||||
xmlErrValidNode(ctxt, state->node,
|
||||
XML_DTD_NOT_PCDATA,
|
||||
"Element %s was declared #PCDATA but contains non text nodes\n",
|
||||
state->node->name, NULL, NULL);
|
||||
ret = 0;
|
||||
} else {
|
||||
ret = xmlValidateCheckMixed(ctxt, elemDecl->content,
|
||||
qname);
|
||||
if (ret != 1) {
|
||||
xmlErrValidNode(ctxt, state->node,
|
||||
XML_DTD_INVALID_CHILD,
|
||||
"Element %s is not declared in %s list of possible children\n",
|
||||
qname, state->node->name, NULL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case XML_ELEMENT_TYPE_ELEMENT:
|
||||
@ -5626,6 +5646,10 @@ xmlValidatePushElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
|
||||
return(0);
|
||||
}
|
||||
if (ret < 0) {
|
||||
xmlErrValidNode(ctxt, state->node,
|
||||
XML_DTD_CONTENT_MODEL,
|
||||
"Element %s content does not follow the DTD, Misplaced %s\n",
|
||||
state->node->name, qname, NULL);
|
||||
ret = 0;
|
||||
} else {
|
||||
ret = 1;
|
||||
@ -5675,6 +5699,10 @@ xmlValidatePushCData(xmlValidCtxtPtr ctxt, const xmlChar *data, int len) {
|
||||
ret = 0;
|
||||
break;
|
||||
case XML_ELEMENT_TYPE_EMPTY:
|
||||
xmlErrValidNode(ctxt, state->node,
|
||||
XML_DTD_NOT_EMPTY,
|
||||
"Element %s was declared EMPTY this one has content\n",
|
||||
state->node->name, NULL, NULL);
|
||||
ret = 0;
|
||||
break;
|
||||
case XML_ELEMENT_TYPE_ANY:
|
||||
@ -5747,6 +5775,11 @@ xmlValidatePopElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc ATTRIBUTE_UNUSED,
|
||||
if (ret <= 0) {
|
||||
if (ret == XML_REGEXP_OUT_OF_MEMORY)
|
||||
xmlVErrMemory(ctxt);
|
||||
else
|
||||
xmlErrValidNode(ctxt, state->node,
|
||||
XML_DTD_CONTENT_MODEL,
|
||||
"Element %s content does not follow the DTD, Expecting more children\n",
|
||||
state->node->name, NULL,NULL);
|
||||
ret = 0;
|
||||
} else {
|
||||
/*
|
||||
@ -5819,13 +5852,8 @@ xmlValidateOneElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
|
||||
* Fetch the declaration
|
||||
*/
|
||||
elemDecl = xmlValidGetElemDecl(ctxt, doc, elem, &extsubset);
|
||||
if (elemDecl == NULL) {
|
||||
xmlErrValidNode(ctxt, elem,
|
||||
XML_DTD_UNKNOWN_ELEM,
|
||||
"No declaration for element %s\n",
|
||||
elem->name, NULL, NULL);
|
||||
if (elemDecl == NULL)
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* If vstateNr is not zero that means continuous validation is
|
||||
|
Loading…
x
Reference in New Issue
Block a user