MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlSchematronReportSuccess

Function xmlSchematronReportSuccess

ThirdParty/libxml2/vtklibxml2/schematron.c:1595–1673  ·  view source on GitHub ↗

* xmlSchematronReportSuccess: * @ctxt: the validation context * @test: the compiled test * @cur: the current node tested * @success: boolean value for the result * * called from the validation engine when an assert or report test have * been done. */

Source from the content-addressed store, hash-verified

1593 * been done.
1594 */
1595static void
1596xmlSchematronReportSuccess(xmlSchematronValidCtxtPtr ctxt,
1597 xmlSchematronTestPtr test, xmlNodePtr cur, xmlSchematronPatternPtr pattern, int success) {
1598 if ((ctxt == NULL) || (cur == NULL) || (test == NULL))
1599 return;
1600 /* if quiet and not SVRL report only failures */
1601 if ((ctxt->flags & XML_SCHEMATRON_OUT_QUIET) &&
1602 ((ctxt->flags & XML_SCHEMATRON_OUT_XML) == 0) &&
1603 (test->type == XML_SCHEMATRON_REPORT))
1604 return;
1605 if (ctxt->flags & XML_SCHEMATRON_OUT_XML) {
1606 /* TODO */
1607 } else {
1608 xmlChar *path;
1609 char msg[1000];
1610 long line;
1611 const xmlChar *report = NULL;
1612
1613 if (((test->type == XML_SCHEMATRON_REPORT) && (!success)) ||
1614 ((test->type == XML_SCHEMATRON_ASSERT) && (success)))
1615 return;
1616 line = xmlGetLineNo(cur);
1617 path = xmlGetNodePath(cur);
1618 if (path == NULL)
1619 path = (xmlChar *) cur->name;
1620#if 0
1621 if ((test->report != NULL) && (test->report[0] != 0))
1622 report = test->report;
1623#endif
1624 if (test->node != NULL)
1625 report = xmlSchematronFormatReport(ctxt, test->node, cur);
1626 if (report == NULL) {
1627 if (test->type == XML_SCHEMATRON_ASSERT) {
1628 report = xmlStrdup((const xmlChar *) "node failed assert");
1629 } else {
1630 report = xmlStrdup((const xmlChar *) "node failed report");
1631 }
1632 }
1633 snprintf(msg, 999, "%s line %ld: %s\n", (const char *) path,
1634 line, (const char *) report);
1635
1636 if (ctxt->flags & XML_SCHEMATRON_OUT_ERROR) {
1637 xmlStructuredErrorFunc schannel;
1638 xmlGenericErrorFunc channel;
1639 void *data;
1640 int res;
1641
1642 schannel = ctxt->serror;
1643 channel = ctxt->error;
1644 data = ctxt->userData;
1645
1646 if ((channel == NULL) && (schannel == NULL)) {
1647 channel = xmlGenericError;
1648 data = xmlGenericErrorContext;
1649 }
1650
1651 res = __xmlRaiseError(schannel, channel, data, NULL, cur,
1652 XML_FROM_SCHEMATRONV,

Callers 1

xmlSchematronRunTestFunction · 0.85

Calls 7

xmlGetLineNoFunction · 0.85
xmlGetNodePathFunction · 0.85
xmlStrdupFunction · 0.85
__xmlRaiseErrorFunction · 0.85
xmlSchematronVErrMemoryFunction · 0.85

Tested by

no test coverage detected