Skip to content

Commit

Permalink
Improve the error report on undefined REFs
Browse files Browse the repository at this point in the history
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
veillard committed Nov 11, 2011
1 parent 5825ebb commit cb3549e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 1 addition & 3 deletions result/valid/xlink.xml.err
@@ -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"
7 changes: 7 additions & 0 deletions valid.c
Expand Up @@ -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);
Expand All @@ -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
*/
Expand All @@ -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);
}

Expand Down

0 comments on commit cb3549e

Please sign in to comment.