version 1.1.1.1, 2012/02/21 23:37:58
|
version 1.1.1.2, 2014/06/15 19:53:29
|
Line 53 static const xmlChar *xmlOldSchematronNs = SCT_OLD_NS;
|
Line 53 static const xmlChar *xmlOldSchematronNs = SCT_OLD_NS;
|
|
|
#define NEXT_SCHEMATRON(node) \ |
#define NEXT_SCHEMATRON(node) \ |
while (node != NULL) { \ |
while (node != NULL) { \ |
if ((node->type == XML_ELEMENT_NODE ) && (node->ns != NULL) && \ | if ((node->type == XML_ELEMENT_NODE ) && (node->ns != NULL) && \ |
((xmlStrEqual(node->ns->href, xmlSchematronNs)) || \ |
((xmlStrEqual(node->ns->href, xmlSchematronNs)) || \ |
(xmlStrEqual(node->ns->href, xmlOldSchematronNs)))) \ |
(xmlStrEqual(node->ns->href, xmlOldSchematronNs)))) \ |
break; \ |
break; \ |
Line 65 static const xmlChar *xmlOldSchematronNs = SCT_OLD_NS;
|
Line 65 static const xmlChar *xmlOldSchematronNs = SCT_OLD_NS;
|
* |
* |
* macro to flag unimplemented blocks |
* macro to flag unimplemented blocks |
*/ |
*/ |
#define TODO \ | #define TODO \ |
xmlGenericError(xmlGenericErrorContext, \ |
xmlGenericError(xmlGenericErrorContext, \ |
"Unimplemented block at %s:%d\n", \ |
"Unimplemented block at %s:%d\n", \ |
__FILE__, __LINE__); |
__FILE__, __LINE__); |
Line 240 xmlSchematronPErrMemory(xmlSchematronParserCtxtPtr ctx
|
Line 240 xmlSchematronPErrMemory(xmlSchematronParserCtxtPtr ctx
|
* @msg: the error message |
* @msg: the error message |
* @str1: extra data |
* @str1: extra data |
* @str2: extra data |
* @str2: extra data |
* | * |
* Handle a parser error |
* Handle a parser error |
*/ |
*/ |
static void |
static void |
Line 568 xmlSchematronFree(xmlSchematronPtr schema)
|
Line 568 xmlSchematronFree(xmlSchematronPtr schema)
|
|
|
if (schema->namespaces != NULL) |
if (schema->namespaces != NULL) |
xmlFree((char **) schema->namespaces); |
xmlFree((char **) schema->namespaces); |
| |
xmlSchematronFreeRules(schema->rules); |
xmlSchematronFreeRules(schema->rules); |
xmlSchematronFreePatterns(schema->patterns); |
xmlSchematronFreePatterns(schema->patterns); |
xmlDictFree(schema->dict); |
xmlDictFree(schema->dict); |
Line 826 xmlSchematronAddNamespace(xmlSchematronParserCtxtPtr c
|
Line 826 xmlSchematronAddNamespace(xmlSchematronParserCtxtPtr c
|
ctxt->namespaces = tmp; |
ctxt->namespaces = tmp; |
ctxt->maxNamespaces *= 2; |
ctxt->maxNamespaces *= 2; |
} |
} |
ctxt->namespaces[2 * ctxt->nbNamespaces] = | ctxt->namespaces[2 * ctxt->nbNamespaces] = |
xmlDictLookup(ctxt->dict, ns, -1); |
xmlDictLookup(ctxt->dict, ns, -1); |
ctxt->namespaces[2 * ctxt->nbNamespaces + 1] = | ctxt->namespaces[2 * ctxt->nbNamespaces + 1] = |
xmlDictLookup(ctxt->dict, prefix, -1); |
xmlDictLookup(ctxt->dict, prefix, -1); |
ctxt->nbNamespaces++; |
ctxt->nbNamespaces++; |
ctxt->namespaces[2 * ctxt->nbNamespaces] = NULL; |
ctxt->namespaces[2 * ctxt->nbNamespaces] = NULL; |
Line 1288 xmlSchematronReportOutput(xmlSchematronValidCtxtPtr ct
|
Line 1288 xmlSchematronReportOutput(xmlSchematronValidCtxtPtr ct
|
* to be deallocated by teh caller |
* to be deallocated by teh caller |
*/ |
*/ |
static xmlChar * |
static xmlChar * |
xmlSchematronFormatReport(xmlSchematronValidCtxtPtr ctxt, | xmlSchematronFormatReport(xmlSchematronValidCtxtPtr ctxt, |
xmlNodePtr test, xmlNodePtr cur) { |
xmlNodePtr test, xmlNodePtr cur) { |
xmlChar *ret = NULL; |
xmlChar *ret = NULL; |
xmlNodePtr child, node; |
xmlNodePtr child, node; |
Line 1314 xmlSchematronFormatReport(xmlSchematronValidCtxtPtr ct
|
Line 1314 xmlSchematronFormatReport(xmlSchematronValidCtxtPtr ct
|
xmlFree(path); |
xmlFree(path); |
} |
} |
|
|
if ((node->ns == NULL) || (node->ns->prefix == NULL)) | if ((node->ns == NULL) || (node->ns->prefix == NULL)) |
ret = xmlStrcat(ret, node->name); |
ret = xmlStrcat(ret, node->name); |
else { |
else { |
ret = xmlStrcat(ret, node->ns->prefix); |
ret = xmlStrcat(ret, node->ns->prefix); |
Line 1365 xmlSchematronFormatReport(xmlSchematronValidCtxtPtr ct
|
Line 1365 xmlSchematronFormatReport(xmlSchematronValidCtxtPtr ct
|
* been done. |
* been done. |
*/ |
*/ |
static void |
static void |
xmlSchematronReportSuccess(xmlSchematronValidCtxtPtr ctxt, | xmlSchematronReportSuccess(xmlSchematronValidCtxtPtr ctxt, |
xmlSchematronTestPtr test, xmlNodePtr cur, xmlSchematronPatternPtr pattern, int success) { |
xmlSchematronTestPtr test, xmlNodePtr cur, xmlSchematronPatternPtr pattern, int success) { |
if ((ctxt == NULL) || (cur == NULL) || (test == NULL)) |
if ((ctxt == NULL) || (cur == NULL) || (test == NULL)) |
return; |
return; |
Line 1445 xmlSchematronReportSuccess(xmlSchematronValidCtxtPtr c
|
Line 1445 xmlSchematronReportSuccess(xmlSchematronValidCtxtPtr c
|
* called from the validation engine when starting to check a pattern |
* called from the validation engine when starting to check a pattern |
*/ |
*/ |
static void |
static void |
xmlSchematronReportPattern(xmlSchematronValidCtxtPtr ctxt, | xmlSchematronReportPattern(xmlSchematronValidCtxtPtr ctxt, |
xmlSchematronPatternPtr pattern) { |
xmlSchematronPatternPtr pattern) { |
if ((ctxt == NULL) || (pattern == NULL)) |
if ((ctxt == NULL) || (pattern == NULL)) |
return; |
return; |
Line 1572 xmlSchematronNextNode(xmlNodePtr cur) {
|
Line 1572 xmlSchematronNextNode(xmlNodePtr cur) {
|
(cur->type != XML_DTD_NODE)) |
(cur->type != XML_DTD_NODE)) |
return(cur); |
return(cur); |
} |
} |
| |
do { |
do { |
cur = cur->parent; |
cur = cur->parent; |
if (cur == NULL) break; |
if (cur == NULL) break; |
Line 1589 xmlSchematronNextNode(xmlNodePtr cur) {
|
Line 1589 xmlSchematronNextNode(xmlNodePtr cur) {
|
* xmlSchematronRunTest: |
* xmlSchematronRunTest: |
* @ctxt: the schema validation context |
* @ctxt: the schema validation context |
* @test: the current test |
* @test: the current test |
* @instance: the document instace tree | * @instance: the document instace tree |
* @cur: the current node in the instance |
* @cur: the current node in the instance |
* |
* |
* Validate a rule against a tree instance at a given position |
* Validate a rule against a tree instance at a given position |
Line 1653 xmlSchematronRunTest(xmlSchematronValidCtxtPtr ctxt,
|
Line 1653 xmlSchematronRunTest(xmlSchematronValidCtxtPtr ctxt,
|
/** |
/** |
* xmlSchematronValidateDoc: |
* xmlSchematronValidateDoc: |
* @ctxt: the schema validation context |
* @ctxt: the schema validation context |
* @instance: the document instace tree | * @instance: the document instace tree |
* |
* |
* Validate a tree instance against the schematron |
* Validate a tree instance against the schematron |
* |
* |
Line 1697 xmlSchematronValidateDoc(xmlSchematronValidCtxtPtr ctx
|
Line 1697 xmlSchematronValidateDoc(xmlSchematronValidCtxtPtr ctx
|
} |
} |
rule = rule->next; |
rule = rule->next; |
} |
} |
| |
cur = xmlSchematronNextNode(cur); |
cur = xmlSchematronNextNode(cur); |
} |
} |
} else { |
} else { |
Line 1705 xmlSchematronValidateDoc(xmlSchematronValidCtxtPtr ctx
|
Line 1705 xmlSchematronValidateDoc(xmlSchematronValidCtxtPtr ctx
|
* Process all contexts one at a time |
* Process all contexts one at a time |
*/ |
*/ |
pattern = ctxt->schema->patterns; |
pattern = ctxt->schema->patterns; |
| |
while (pattern != NULL) { |
while (pattern != NULL) { |
xmlSchematronReportPattern(ctxt, pattern); |
xmlSchematronReportPattern(ctxt, pattern); |
|
|
/* |
/* |
* TODO convert the pattern rule to a direct XPath and |
* TODO convert the pattern rule to a direct XPath and |
* compute directly instead of using the pattern matching |
* compute directly instead of using the pattern matching |
* over the full document... | * over the full document... |
* Check the exact semantic |
* Check the exact semantic |
*/ |
*/ |
cur = root; |
cur = root; |
Line 1728 xmlSchematronValidateDoc(xmlSchematronValidCtxtPtr ctx
|
Line 1728 xmlSchematronValidateDoc(xmlSchematronValidCtxtPtr ctx
|
} |
} |
rule = rule->patnext; |
rule = rule->patnext; |
} |
} |
| |
cur = xmlSchematronNextNode(cur); |
cur = xmlSchematronNextNode(cur); |
} |
} |
pattern = pattern->next; |
pattern = pattern->next; |