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

Function xmlSchematronParsePattern

ThirdParty/libxml2/vtklibxml2/schematron.c:1133–1172  ·  view source on GitHub ↗

* xmlSchematronParsePattern: * @ctxt: a schema validation context * @pat: the pattern node * * parse a pattern element */

Source from the content-addressed store, hash-verified

1131 * parse a pattern element
1132 */
1133static void
1134xmlSchematronParsePattern(xmlSchematronParserCtxtPtr ctxt, xmlNodePtr pat)
1135{
1136 xmlNodePtr cur;
1137 xmlSchematronPatternPtr pattern;
1138 int nbRules = 0;
1139 xmlChar *id;
1140
1141 if ((ctxt == NULL) || (pat == NULL)) return;
1142
1143 id = xmlGetNoNsProp(pat, BAD_CAST "id");
1144 if (id == NULL) {
1145 id = xmlGetNoNsProp(pat, BAD_CAST "name");
1146 }
1147 pattern = xmlSchematronAddPattern(ctxt, ctxt->schema, pat, id);
1148 if (pattern == NULL) {
1149 if (id != NULL)
1150 xmlFree(id);
1151 return;
1152 }
1153 cur = pat->children;
1154 NEXT_SCHEMATRON(cur);
1155 while (cur != NULL) {
1156 if (IS_SCHEMATRON(cur, "rule")) {
1157 xmlSchematronParseRule(ctxt, pattern, cur);
1158 nbRules++;
1159 } else {
1160 xmlSchematronPErr(ctxt, cur,
1161 XML_SCHEMAP_NOROOT,
1162 "Expecting a rule element instead of %s", cur->name, NULL);
1163 }
1164 cur = cur->next;
1165 NEXT_SCHEMATRON(cur);
1166 }
1167 if (nbRules == 0) {
1168 xmlSchematronPErr(ctxt, pat,
1169 XML_SCHEMAP_NOROOT,
1170 "Pattern has no rule element", NULL, NULL);
1171 }
1172}
1173
1174#if 0
1175/**

Callers 1

xmlSchematronParseFunction · 0.85

Calls 3

xmlGetNoNsPropFunction · 0.85
xmlSchematronAddPatternFunction · 0.85
xmlSchematronParseRuleFunction · 0.85

Tested by

no test coverage detected