Permalink
Browse files

Improve the error report on undefined REFs

Use the tree node to provide the error context instead
of the parser input which is not relevant anymore,
based on a suggestion by François Delyon <f.delyon@satimage.fr>
  • Loading branch information...
1 parent 5825ebb commit cb3549e30a63935fa840d61412abe828b0c6753e @veillard veillard committed Nov 11, 2011
Showing with 8 additions and 3 deletions.
  1. +1 −3 result/valid/xlink.xml.err
  2. +7 −0 valid.c
@@ -1,6 +1,4 @@
./test/valid/xlink.xml:450: element termdef: validity error : ID dt-arc already defined
<p><termdef id="dt-arc" term="Arc">An <term>arc</term> is contained within an e
^
-./test/valid/xlink.xml:530: element termref: validity error : IDREF attribute def references an unknown ID "dt-xlg"
-
-^
+./test/valid/xlink.xml:199: element termref: validity error : IDREF attribute def references an unknown ID "dt-xlg"
View
@@ -6559,6 +6559,7 @@ xmlValidateCheckRefCallback(xmlListPtr ref_list, xmlValidCtxtPtr ctxt,
int
xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, xmlDocPtr doc) {
xmlRefTablePtr table;
+ unsigned int save;
if (ctxt == NULL)
return(0);
@@ -6568,6 +6569,10 @@ xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, xmlDocPtr doc) {
return(0);
}
+ /* trick to get correct line id report */
+ save = ctxt->finishDtd;
+ ctxt->finishDtd = 0;
+
/*
* Check all the NOTATION/NOTATIONS attributes
*/
@@ -6581,6 +6586,8 @@ xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, xmlDocPtr doc) {
ctxt->doc = doc;
ctxt->valid = 1;
xmlHashScan(table, (xmlHashScanner) xmlValidateCheckRefCallback, ctxt);
+
+ ctxt->finishDtd = save;
return(ctxt->valid);
}

0 comments on commit cb3549e

Please sign in to comment.