• Home
  • Raw
  • Download

Lines Matching refs:ctxt

226 xmlSchematronPErrMemory(xmlSchematronParserCtxtPtr ctxt,  in xmlSchematronPErrMemory()  argument
229 if (ctxt != NULL) in xmlSchematronPErrMemory()
230 ctxt->nberrors++; in xmlSchematronPErrMemory()
247 xmlSchematronPErr(xmlSchematronParserCtxtPtr ctxt, xmlNodePtr node, int error, in xmlSchematronPErr() argument
254 if (ctxt != NULL) { in xmlSchematronPErr()
255 ctxt->nberrors++; in xmlSchematronPErr()
256 channel = ctxt->error; in xmlSchematronPErr()
257 data = ctxt->userData; in xmlSchematronPErr()
258 schannel = ctxt->serror; in xmlSchematronPErr()
260 __xmlRaiseError(schannel, channel, data, ctxt, node, XML_FROM_SCHEMASP, in xmlSchematronPErr()
274 xmlSchematronVErrMemory(xmlSchematronValidCtxtPtr ctxt, in xmlSchematronVErrMemory() argument
277 if (ctxt != NULL) { in xmlSchematronVErrMemory()
278 ctxt->nberrors++; in xmlSchematronVErrMemory()
279 ctxt->err = XML_SCHEMAV_INTERNAL; in xmlSchematronVErrMemory()
305 xmlSchematronAddTest(xmlSchematronParserCtxtPtr ctxt, in xmlSchematronAddTest() argument
313 if ((ctxt == NULL) || (rule == NULL) || (node == NULL) || in xmlSchematronAddTest()
320 comp = xmlXPathCtxtCompile(ctxt->xctxt, test); in xmlSchematronAddTest()
322 xmlSchematronPErr(ctxt, node, in xmlSchematronAddTest()
331 xmlSchematronPErrMemory(ctxt, "allocating schema test", node); in xmlSchematronAddTest()
389 xmlSchematronAddRule(xmlSchematronParserCtxtPtr ctxt, xmlSchematronPtr schema, in xmlSchematronAddRule() argument
396 if ((ctxt == NULL) || (schema == NULL) || (node == NULL) || in xmlSchematronAddRule()
403 pattern = xmlPatterncompile(context, ctxt->dict, XML_PATTERN_XPATH, in xmlSchematronAddRule()
404 ctxt->namespaces); in xmlSchematronAddRule()
406 xmlSchematronPErr(ctxt, node, in xmlSchematronAddRule()
414 xmlSchematronPErrMemory(ctxt, "allocating schema rule", node); in xmlSchematronAddRule()
482 xmlSchematronAddPattern(xmlSchematronParserCtxtPtr ctxt, in xmlSchematronAddPattern() argument
487 if ((ctxt == NULL) || (schema == NULL) || (node == NULL) || (name == NULL)) in xmlSchematronAddPattern()
492 xmlSchematronPErrMemory(ctxt, "allocating schema pattern", node); in xmlSchematronAddPattern()
538 xmlSchematronNewSchematron(xmlSchematronParserCtxtPtr ctxt) in xmlSchematronNewSchematron() argument
544 xmlSchematronPErrMemory(ctxt, "allocating schema", NULL); in xmlSchematronNewSchematron()
548 ret->dict = ctxt->dict; in xmlSchematronNewSchematron()
707 xmlSchematronFreeParserCtxt(xmlSchematronParserCtxtPtr ctxt) in xmlSchematronFreeParserCtxt() argument
709 if (ctxt == NULL) in xmlSchematronFreeParserCtxt()
711 if (ctxt->doc != NULL && !ctxt->preserve) in xmlSchematronFreeParserCtxt()
712 xmlFreeDoc(ctxt->doc); in xmlSchematronFreeParserCtxt()
713 if (ctxt->xctxt != NULL) { in xmlSchematronFreeParserCtxt()
714 xmlXPathFreeContext(ctxt->xctxt); in xmlSchematronFreeParserCtxt()
716 if (ctxt->namespaces != NULL) in xmlSchematronFreeParserCtxt()
717 xmlFree((char **) ctxt->namespaces); in xmlSchematronFreeParserCtxt()
718 xmlDictFree(ctxt->dict); in xmlSchematronFreeParserCtxt()
719 xmlFree(ctxt); in xmlSchematronFreeParserCtxt()
732 xmlSchematronPushInclude(xmlSchematronParserCtxtPtr ctxt,
735 if (ctxt->includes == NULL) {
736 ctxt->maxIncludes = 10;
737 ctxt->includes = (xmlNodePtr *)
738 xmlMalloc(ctxt->maxIncludes * 2 * sizeof(xmlNodePtr));
739 if (ctxt->includes == NULL) {
744 ctxt->nbIncludes = 0;
745 } else if (ctxt->nbIncludes + 2 >= ctxt->maxIncludes) {
749 xmlRealloc(ctxt->includes, ctxt->maxIncludes * 4 *
756 ctxt->includes = tmp;
757 ctxt->maxIncludes *= 2;
759 ctxt->includes[2 * ctxt->nbIncludes] = cur;
760 ctxt->includes[2 * ctxt->nbIncludes + 1] = (xmlNodePtr) doc;
761 ctxt->nbIncludes++;
774 xmlSchematronPopInclude(xmlSchematronParserCtxtPtr ctxt)
779 if (ctxt->nbIncludes <= 0)
781 ctxt->nbIncludes--;
782 doc = (xmlDocPtr) ctxt->includes[2 * ctxt->nbIncludes + 1];
783 ret = ctxt->includes[2 * ctxt->nbIncludes];
788 return(xmlSchematronPopInclude(ctxt));
802 xmlSchematronAddNamespace(xmlSchematronParserCtxtPtr ctxt, in xmlSchematronAddNamespace() argument
805 if (ctxt->namespaces == NULL) { in xmlSchematronAddNamespace()
806 ctxt->maxNamespaces = 10; in xmlSchematronAddNamespace()
807 ctxt->namespaces = (const xmlChar **) in xmlSchematronAddNamespace()
808 xmlMalloc(ctxt->maxNamespaces * 2 * sizeof(const xmlChar *)); in xmlSchematronAddNamespace()
809 if (ctxt->namespaces == NULL) { in xmlSchematronAddNamespace()
814 ctxt->nbNamespaces = 0; in xmlSchematronAddNamespace()
815 } else if (ctxt->nbNamespaces + 2 >= ctxt->maxNamespaces) { in xmlSchematronAddNamespace()
819 xmlRealloc((xmlChar **) ctxt->namespaces, ctxt->maxNamespaces * 4 * in xmlSchematronAddNamespace()
826 ctxt->namespaces = tmp; in xmlSchematronAddNamespace()
827 ctxt->maxNamespaces *= 2; in xmlSchematronAddNamespace()
829 ctxt->namespaces[2 * ctxt->nbNamespaces] = in xmlSchematronAddNamespace()
830 xmlDictLookup(ctxt->dict, ns, -1); in xmlSchematronAddNamespace()
831 ctxt->namespaces[2 * ctxt->nbNamespaces + 1] = in xmlSchematronAddNamespace()
832 xmlDictLookup(ctxt->dict, prefix, -1); in xmlSchematronAddNamespace()
833 ctxt->nbNamespaces++; in xmlSchematronAddNamespace()
834 ctxt->namespaces[2 * ctxt->nbNamespaces] = NULL; in xmlSchematronAddNamespace()
835 ctxt->namespaces[2 * ctxt->nbNamespaces + 1] = NULL; in xmlSchematronAddNamespace()
847 xmlSchematronParseRule(xmlSchematronParserCtxtPtr ctxt, in xmlSchematronParseRule() argument
859 if ((ctxt == NULL) || (rule == NULL)) return; in xmlSchematronParseRule()
863 xmlSchematronPErr(ctxt, rule, in xmlSchematronParseRule()
869 xmlSchematronPErr(ctxt, rule, in xmlSchematronParseRule()
876 ruleptr = xmlSchematronAddRule(ctxt, ctxt->schema, pattern, in xmlSchematronParseRule()
891 xmlSchematronPErr(ctxt, cur, in xmlSchematronParseRule()
896 xmlSchematronPErr(ctxt, cur, in xmlSchematronParseRule()
905 testptr = xmlSchematronAddTest(ctxt, XML_SCHEMATRON_ASSERT, in xmlSchematronParseRule()
914 xmlSchematronPErr(ctxt, cur, in xmlSchematronParseRule()
919 xmlSchematronPErr(ctxt, cur, in xmlSchematronParseRule()
928 testptr = xmlSchematronAddTest(ctxt, XML_SCHEMATRON_REPORT, in xmlSchematronParseRule()
934 xmlSchematronPErr(ctxt, cur, in xmlSchematronParseRule()
943 xmlSchematronPErr(ctxt, rule, in xmlSchematronParseRule()
957 xmlSchematronParsePattern(xmlSchematronParserCtxtPtr ctxt, xmlNodePtr pat) in xmlSchematronParsePattern() argument
964 if ((ctxt == NULL) || (pat == NULL)) return; in xmlSchematronParsePattern()
970 pattern = xmlSchematronAddPattern(ctxt, ctxt->schema, pat, id); in xmlSchematronParsePattern()
980 xmlSchematronParseRule(ctxt, pattern, cur); in xmlSchematronParsePattern()
983 xmlSchematronPErr(ctxt, cur, in xmlSchematronParsePattern()
991 xmlSchematronPErr(ctxt, pat, in xmlSchematronParsePattern()
1008 xmlSchematronLoadInclude(xmlSchematronParserCtxtPtr ctxt, xmlNodePtr cur)
1016 if ((ctxt == NULL) || (cur == NULL))
1021 xmlSchematronPErr(ctxt, cur,
1032 xmlSchematronPErr(ctxt, cur,
1040 xmlSchematronPErr(ctxt, cur,
1048 xmlSchematronPushInclude(ctxt, doc, cur);
1075 xmlSchematronParse(xmlSchematronParserCtxtPtr ctxt) in xmlSchematronParse() argument
1082 if (ctxt == NULL) in xmlSchematronParse()
1085 ctxt->nberrors = 0; in xmlSchematronParse()
1090 if (ctxt->URL != NULL) { in xmlSchematronParse()
1091 doc = xmlReadFile((const char *) ctxt->URL, NULL, in xmlSchematronParse()
1094 xmlSchematronPErr(ctxt, NULL, in xmlSchematronParse()
1097 ctxt->URL, NULL); in xmlSchematronParse()
1100 ctxt->preserve = 0; in xmlSchematronParse()
1101 } else if (ctxt->buffer != NULL) { in xmlSchematronParse()
1102 doc = xmlReadMemory(ctxt->buffer, ctxt->size, NULL, NULL, in xmlSchematronParse()
1105 xmlSchematronPErr(ctxt, NULL, in xmlSchematronParse()
1112 ctxt->URL = xmlDictLookup(ctxt->dict, BAD_CAST "in_memory_buffer", -1); in xmlSchematronParse()
1113 ctxt->preserve = 0; in xmlSchematronParse()
1114 } else if (ctxt->doc != NULL) { in xmlSchematronParse()
1115 doc = ctxt->doc; in xmlSchematronParse()
1117 ctxt->preserve = 1; in xmlSchematronParse()
1119 xmlSchematronPErr(ctxt, NULL, in xmlSchematronParse()
1131 xmlSchematronPErr(ctxt, (xmlNodePtr) doc, in xmlSchematronParse()
1141 xmlSchematronPErr(ctxt, root, in xmlSchematronParse()
1144 ctxt->URL, NULL); in xmlSchematronParse()
1147 ret = xmlSchematronNewSchematron(ctxt); in xmlSchematronParse()
1150 ctxt->schema = ret; in xmlSchematronParse()
1170 xmlSchematronPErr(ctxt, cur, in xmlSchematronParse()
1175 xmlSchematronPErr(ctxt, cur, in xmlSchematronParse()
1180 xmlXPathRegisterNs(ctxt->xctxt, prefix, uri); in xmlSchematronParse()
1181 xmlSchematronAddNamespace(ctxt, prefix, uri); in xmlSchematronParse()
1193 xmlSchematronParsePattern(ctxt, cur); in xmlSchematronParse()
1196 xmlSchematronPErr(ctxt, cur, in xmlSchematronParse()
1204 xmlSchematronPErr(ctxt, root, in xmlSchematronParse()
1207 ctxt->URL, NULL); in xmlSchematronParse()
1222 if (ctxt->nberrors != 0) { in xmlSchematronParse()
1226 ret->namespaces = ctxt->namespaces; in xmlSchematronParse()
1227 ret->nbNamespaces = ctxt->nbNamespaces; in xmlSchematronParse()
1228 ctxt->namespaces = NULL; in xmlSchematronParse()
1241 xmlSchematronGetNode(xmlSchematronValidCtxtPtr ctxt, in xmlSchematronGetNode() argument
1246 if ((ctxt == NULL) || (cur == NULL) || (xpath == NULL)) in xmlSchematronGetNode()
1249 ctxt->xctxt->doc = cur->doc; in xmlSchematronGetNode()
1250 ctxt->xctxt->node = cur; in xmlSchematronGetNode()
1251 ret = xmlXPathEval(xpath, ctxt->xctxt); in xmlSchematronGetNode()
1272 xmlSchematronReportOutput(xmlSchematronValidCtxtPtr ctxt ATTRIBUTE_UNUSED, in xmlSchematronReportOutput()
1291 xmlSchematronFormatReport(xmlSchematronValidCtxtPtr ctxt, in xmlSchematronFormatReport() argument
1311 node = xmlSchematronGetNode(ctxt, cur, path); in xmlSchematronFormatReport()
1368 xmlSchematronReportSuccess(xmlSchematronValidCtxtPtr ctxt, in xmlSchematronReportSuccess() argument
1370 if ((ctxt == NULL) || (cur == NULL) || (test == NULL)) in xmlSchematronReportSuccess()
1373 if ((ctxt->flags & XML_SCHEMATRON_OUT_QUIET) && in xmlSchematronReportSuccess()
1374 ((ctxt->flags & XML_SCHEMATRON_OUT_XML) == 0) && in xmlSchematronReportSuccess()
1377 if (ctxt->flags & XML_SCHEMATRON_OUT_XML) { in xmlSchematronReportSuccess()
1397 report = xmlSchematronFormatReport(ctxt, test->node, cur); in xmlSchematronReportSuccess()
1408 if (ctxt->flags & XML_SCHEMATRON_OUT_ERROR) { in xmlSchematronReportSuccess()
1413 if (ctxt != NULL) { in xmlSchematronReportSuccess()
1414 if (ctxt->serror != NULL) in xmlSchematronReportSuccess()
1415 schannel = ctxt->serror; in xmlSchematronReportSuccess()
1417 channel = ctxt->error; in xmlSchematronReportSuccess()
1418 data = ctxt->userData; in xmlSchematronReportSuccess()
1430 xmlSchematronReportOutput(ctxt, cur, &msg[0]); in xmlSchematronReportSuccess()
1448 xmlSchematronReportPattern(xmlSchematronValidCtxtPtr ctxt, in xmlSchematronReportPattern() argument
1450 if ((ctxt == NULL) || (pattern == NULL)) in xmlSchematronReportPattern()
1452 …if ((ctxt->flags & XML_SCHEMATRON_OUT_QUIET) || (ctxt->flags & XML_SCHEMATRON_OUT_ERROR)) /* Error… in xmlSchematronReportPattern()
1454 if (ctxt->flags & XML_SCHEMATRON_OUT_XML) { in xmlSchematronReportPattern()
1462 xmlSchematronReportOutput(ctxt, NULL, &msg[0]); in xmlSchematronReportPattern()
1482 xmlSchematronSetValidStructuredErrors(xmlSchematronValidCtxtPtr ctxt, in xmlSchematronSetValidStructuredErrors() argument
1485 if (ctxt == NULL) in xmlSchematronSetValidStructuredErrors()
1487 ctxt->serror = serror; in xmlSchematronSetValidStructuredErrors()
1488 ctxt->error = NULL; in xmlSchematronSetValidStructuredErrors()
1489 ctxt->warning = NULL; in xmlSchematronSetValidStructuredErrors()
1490 ctxt->userData = ctx; in xmlSchematronSetValidStructuredErrors()
1542 xmlSchematronFreeValidCtxt(xmlSchematronValidCtxtPtr ctxt) in xmlSchematronFreeValidCtxt() argument
1544 if (ctxt == NULL) in xmlSchematronFreeValidCtxt()
1546 if (ctxt->xctxt != NULL) in xmlSchematronFreeValidCtxt()
1547 xmlXPathFreeContext(ctxt->xctxt); in xmlSchematronFreeValidCtxt()
1548 if (ctxt->dict != NULL) in xmlSchematronFreeValidCtxt()
1549 xmlDictFree(ctxt->dict); in xmlSchematronFreeValidCtxt()
1550 xmlFree(ctxt); in xmlSchematronFreeValidCtxt()
1600 xmlSchematronRunTest(xmlSchematronValidCtxtPtr ctxt, in xmlSchematronRunTest() argument
1607 ctxt->xctxt->doc = instance; in xmlSchematronRunTest()
1608 ctxt->xctxt->node = cur; in xmlSchematronRunTest()
1609 ret = xmlXPathCompiledEval(test->comp, ctxt->xctxt); in xmlSchematronRunTest()
1644 ctxt->nberrors++; in xmlSchematronRunTest()
1646 ctxt->nberrors++; in xmlSchematronRunTest()
1648 xmlSchematronReportSuccess(ctxt, test, cur, pattern, !failed); in xmlSchematronRunTest()
1664 xmlSchematronValidateDoc(xmlSchematronValidCtxtPtr ctxt, xmlDocPtr instance) in xmlSchematronValidateDoc() argument
1671 if ((ctxt == NULL) || (ctxt->schema == NULL) || in xmlSchematronValidateDoc()
1672 (ctxt->schema->rules == NULL) || (instance == NULL)) in xmlSchematronValidateDoc()
1674 ctxt->nberrors = 0; in xmlSchematronValidateDoc()
1678 ctxt->nberrors++; in xmlSchematronValidateDoc()
1681 if ((ctxt->flags & XML_SCHEMATRON_OUT_QUIET) || in xmlSchematronValidateDoc()
1682 (ctxt->flags == 0)) { in xmlSchematronValidateDoc()
1689 rule = ctxt->schema->rules; in xmlSchematronValidateDoc()
1694 xmlSchematronRunTest(ctxt, test, instance, cur, (xmlSchematronPatternPtr)rule->pattern); in xmlSchematronValidateDoc()
1707 pattern = ctxt->schema->patterns; in xmlSchematronValidateDoc()
1710 xmlSchematronReportPattern(ctxt, pattern); in xmlSchematronValidateDoc()
1725 xmlSchematronRunTest(ctxt, test, instance, cur, pattern); in xmlSchematronValidateDoc()
1737 return(ctxt->nberrors); in xmlSchematronValidateDoc()