mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-09 04:58:16 +03:00
report improvement more tests Daniel
* schematron.c: report improvement * test/schematron/zvon* result/schematron/zvon*: more tests Daniel
This commit is contained in:
parent
5fe95a8fd9
commit
d541c8f8b4
@ -1,3 +1,8 @@
|
||||
Sun Jul 31 18:48:55 CEST 2005 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* schematron.c: report improvement
|
||||
* test/schematron/zvon* result/schematron/zvon*: more tests
|
||||
|
||||
Sun Jul 31 16:02:59 CEST 2005 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* win32/Makefile.msvc win32/configure.js: applied patch from Rob
|
||||
|
4
result/schematron/zvon11_0
Normal file
4
result/schematron/zvon11_0
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
<BBB aaa="A" bbb="B"/>
|
||||
</AAA>
|
2
result/schematron/zvon11_0.err
Normal file
2
result/schematron/zvon11_0.err
Normal file
@ -0,0 +1,2 @@
|
||||
Pattern: Attributes present
|
||||
./test/schematron/zvon11_0.xml validates
|
4
result/schematron/zvon11_1
Normal file
4
result/schematron/zvon11_1
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
<BBB bbb="B"/>
|
||||
</AAA>
|
3
result/schematron/zvon11_1.err
Normal file
3
result/schematron/zvon11_1.err
Normal file
@ -0,0 +1,3 @@
|
||||
Pattern: Attributes present
|
||||
/AAA/BBB line 2: The element must not have an isolated bbb attribute
|
||||
./test/schematron/zvon11_1.xml fails to validate
|
4
result/schematron/zvon11_2
Normal file
4
result/schematron/zvon11_2
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
<BBB aaa="A"/>
|
||||
</AAA>
|
3
result/schematron/zvon11_2.err
Normal file
3
result/schematron/zvon11_2.err
Normal file
@ -0,0 +1,3 @@
|
||||
Pattern: Attributes present
|
||||
/AAA/BBB line 2: The element must not have an isolated aaa attribute
|
||||
./test/schematron/zvon11_2.xml fails to validate
|
4
result/schematron/zvon11_3
Normal file
4
result/schematron/zvon11_3
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
<BBB/>
|
||||
</AAA>
|
2
result/schematron/zvon11_3.err
Normal file
2
result/schematron/zvon11_3.err
Normal file
@ -0,0 +1,2 @@
|
||||
Pattern: Attributes present
|
||||
./test/schematron/zvon11_3.xml validates
|
4
result/schematron/zvon12_0
Normal file
4
result/schematron/zvon12_0
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
<BBB bbb="C"/>
|
||||
</AAA>
|
3
result/schematron/zvon12_0.err
Normal file
3
result/schematron/zvon12_0.err
Normal file
@ -0,0 +1,3 @@
|
||||
Pattern: Number of characters in an abbreviation
|
||||
/AAA/BBB line 2: There is not enough letters in the abbreviation
|
||||
./test/schematron/zvon12_0.xml fails to validate
|
4
result/schematron/zvon12_1
Normal file
4
result/schematron/zvon12_1
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
<BBB bbb="CZ"/>
|
||||
</AAA>
|
2
result/schematron/zvon12_1.err
Normal file
2
result/schematron/zvon12_1.err
Normal file
@ -0,0 +1,2 @@
|
||||
Pattern: Number of characters in an abbreviation
|
||||
./test/schematron/zvon12_1.xml validates
|
4
result/schematron/zvon12_2
Normal file
4
result/schematron/zvon12_2
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
<BBB bbb="CZCZ"/>
|
||||
</AAA>
|
3
result/schematron/zvon12_2.err
Normal file
3
result/schematron/zvon12_2.err
Normal file
@ -0,0 +1,3 @@
|
||||
Pattern: Number of characters in an abbreviation
|
||||
/AAA/BBB line 2: There is too much letters in the abbreviation
|
||||
./test/schematron/zvon12_2.xml fails to validate
|
7
result/schematron/zvon13_0
Normal file
7
result/schematron/zvon13_0
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<Total>
|
||||
<Percent>20</Percent>
|
||||
<Percent>30</Percent>
|
||||
<Percent>10</Percent>
|
||||
<Percent>50</Percent>
|
||||
</Total>
|
3
result/schematron/zvon13_0.err
Normal file
3
result/schematron/zvon13_0.err
Normal file
@ -0,0 +1,3 @@
|
||||
Pattern: Sum equals 100%.
|
||||
/Total line 1: The values do not sum to 100%.
|
||||
./test/schematron/zvon13_0.xml fails to validate
|
6
result/schematron/zvon13_1
Normal file
6
result/schematron/zvon13_1
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<Total>
|
||||
<Percent>20</Percent>
|
||||
<Percent>10</Percent>
|
||||
<Percent>50</Percent>
|
||||
</Total>
|
3
result/schematron/zvon13_1.err
Normal file
3
result/schematron/zvon13_1.err
Normal file
@ -0,0 +1,3 @@
|
||||
Pattern: Sum equals 100%.
|
||||
/Total line 1: The values do not sum to 100%.
|
||||
./test/schematron/zvon13_1.xml fails to validate
|
6
result/schematron/zvon13_2
Normal file
6
result/schematron/zvon13_2
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<Total>
|
||||
<Percent>20</Percent>
|
||||
<Percent>30</Percent>
|
||||
<Percent>50</Percent>
|
||||
</Total>
|
2
result/schematron/zvon13_2.err
Normal file
2
result/schematron/zvon13_2.err
Normal file
@ -0,0 +1,2 @@
|
||||
Pattern: Sum equals 100%.
|
||||
./test/schematron/zvon13_2.xml validates
|
13
result/schematron/zvon14_0
Normal file
13
result/schematron/zvon14_0
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
<BBB>
|
||||
<CCC/>
|
||||
</BBB>
|
||||
<CCC/>
|
||||
<DDD>
|
||||
<CCC/>
|
||||
<EEE>
|
||||
<CCC/>
|
||||
</EEE>
|
||||
</DDD>
|
||||
</AAA>
|
4
result/schematron/zvon14_0.err
Normal file
4
result/schematron/zvon14_0.err
Normal file
@ -0,0 +1,4 @@
|
||||
Pattern: a child of selected elements
|
||||
/AAA/CCC line 5: Element CCC must not be a child of element AAA
|
||||
/AAA/DDD/EEE/CCC line 9: Element CCC must not be a child of element EEE
|
||||
./test/schematron/zvon14_0.xml fails to validate
|
5
result/schematron/zvon15_0
Normal file
5
result/schematron/zvon15_0
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA name="aaa">
|
||||
<BBB id="bbb"/>
|
||||
<CCC color="ccc"/>
|
||||
</AAA>
|
4
result/schematron/zvon15_0.err
Normal file
4
result/schematron/zvon15_0.err
Normal file
@ -0,0 +1,4 @@
|
||||
Pattern: id is the only permited attribute name
|
||||
/AAA line 1: Attribute name is forbidden in element AAA
|
||||
/AAA/CCC line 3: Attribute color is forbidden in element CCC
|
||||
./test/schematron/zvon15_0.xml fails to validate
|
7
result/schematron/zvon4_0
Normal file
7
result/schematron/zvon4_0
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
<BBB>
|
||||
<CCC/>
|
||||
<CCC/>
|
||||
</BBB>
|
||||
</AAA>
|
3
result/schematron/zvon4_0.err
Normal file
3
result/schematron/zvon4_0.err
Normal file
@ -0,0 +1,3 @@
|
||||
Pattern: Root test
|
||||
/AAA line 1: Root element is AAA
|
||||
./test/schematron/zvon4_0.xml fails to validate
|
7
result/schematron/zvon4_1
Normal file
7
result/schematron/zvon4_1
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<XXX>
|
||||
<BBB>
|
||||
<CCC/>
|
||||
<CCC/>
|
||||
</BBB>
|
||||
</XXX>
|
3
result/schematron/zvon4_1.err
Normal file
3
result/schematron/zvon4_1.err
Normal file
@ -0,0 +1,3 @@
|
||||
Pattern: Root test
|
||||
/XXX line 1: Root element is XXX, not AAA
|
||||
./test/schematron/zvon4_1.xml fails to validate
|
6
result/schematron/zvon5_0
Normal file
6
result/schematron/zvon5_0
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
<BBB>
|
||||
<CCC/>
|
||||
</BBB>
|
||||
</AAA>
|
7
result/schematron/zvon5_0.err
Normal file
7
result/schematron/zvon5_0.err
Normal file
@ -0,0 +1,7 @@
|
||||
Pattern: Select empty elements CCC
|
||||
/AAA/BBB/CCC line 3: Source contains an empty element CCC
|
||||
/AAA/BBB/CCC line 3: [1]An element CCC does not contain any text
|
||||
/AAA/BBB/CCC line 3: [2]An element CCC does not contain any text
|
||||
/AAA/BBB/CCC line 3: [1]An element CCC does not contain any child element
|
||||
/AAA/BBB/CCC line 3: [2]An element CCC does not contain any child element
|
||||
./test/schematron/zvon5_0.xml fails to validate
|
6
result/schematron/zvon5_1
Normal file
6
result/schematron/zvon5_1
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
<BBB>
|
||||
<CCC>I am CCC element</CCC>
|
||||
</BBB>
|
||||
</AAA>
|
5
result/schematron/zvon5_1.err
Normal file
5
result/schematron/zvon5_1.err
Normal file
@ -0,0 +1,5 @@
|
||||
Pattern: Select empty elements CCC
|
||||
/AAA/BBB/CCC line 3: Source contains an empty element CCC
|
||||
/AAA/BBB/CCC line 3: [1]An element CCC does not contain any child element
|
||||
/AAA/BBB/CCC line 3: [2]An element CCC does not contain any child element
|
||||
./test/schematron/zvon5_1.xml fails to validate
|
8
result/schematron/zvon5_2
Normal file
8
result/schematron/zvon5_2
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
<BBB>
|
||||
<CCC>
|
||||
<DDD/>
|
||||
</CCC>
|
||||
</BBB>
|
||||
</AAA>
|
5
result/schematron/zvon5_2.err
Normal file
5
result/schematron/zvon5_2.err
Normal file
@ -0,0 +1,5 @@
|
||||
Pattern: Select empty elements CCC
|
||||
/AAA/BBB/CCC line 3: Source contains an empty element CCC
|
||||
/AAA/BBB/CCC line 3: [1]An element CCC does not contain any text
|
||||
/AAA/BBB/CCC line 3: [2]An element CCC does not contain any text
|
||||
./test/schematron/zvon5_2.xml fails to validate
|
4
result/schematron/zvon6_0
Normal file
4
result/schematron/zvon6_0
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
aaa
|
||||
</AAA>
|
3
result/schematron/zvon6_0.err
Normal file
3
result/schematron/zvon6_0.err
Normal file
@ -0,0 +1,3 @@
|
||||
Pattern: Predefined values
|
||||
/AAA line 1: O.K.
|
||||
./test/schematron/zvon6_0.xml fails to validate
|
4
result/schematron/zvon6_1
Normal file
4
result/schematron/zvon6_1
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
bbb
|
||||
</AAA>
|
3
result/schematron/zvon6_1.err
Normal file
3
result/schematron/zvon6_1.err
Normal file
@ -0,0 +1,3 @@
|
||||
Pattern: Predefined values
|
||||
/AAA line 1: O.K.
|
||||
./test/schematron/zvon6_1.xml fails to validate
|
4
result/schematron/zvon6_2
Normal file
4
result/schematron/zvon6_2
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
ccc
|
||||
</AAA>
|
3
result/schematron/zvon6_2.err
Normal file
3
result/schematron/zvon6_2.err
Normal file
@ -0,0 +1,3 @@
|
||||
Pattern: Predefined values
|
||||
/AAA line 1: The AAA value is not permitted.
|
||||
./test/schematron/zvon6_2.xml fails to validate
|
4
result/schematron/zvon7_0
Normal file
4
result/schematron/zvon7_0
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
aaa
|
||||
</AAA>
|
3
result/schematron/zvon7_0.err
Normal file
3
result/schematron/zvon7_0.err
Normal file
@ -0,0 +1,3 @@
|
||||
Pattern: Test integer
|
||||
/AAA line 1: The AAA value is not an integer.
|
||||
./test/schematron/zvon7_0.xml fails to validate
|
4
result/schematron/zvon7_1
Normal file
4
result/schematron/zvon7_1
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
12.234
|
||||
</AAA>
|
3
result/schematron/zvon7_1.err
Normal file
3
result/schematron/zvon7_1.err
Normal file
@ -0,0 +1,3 @@
|
||||
Pattern: Test integer
|
||||
/AAA line 1: The AAA value is not an integer.
|
||||
./test/schematron/zvon7_1.xml fails to validate
|
4
result/schematron/zvon7_2
Normal file
4
result/schematron/zvon7_2
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
45
|
||||
</AAA>
|
3
result/schematron/zvon7_2.err
Normal file
3
result/schematron/zvon7_2.err
Normal file
@ -0,0 +1,3 @@
|
||||
Pattern: Test integer
|
||||
/AAA line 1: O.K.
|
||||
./test/schematron/zvon7_2.xml fails to validate
|
4
result/schematron/zvon7_3
Normal file
4
result/schematron/zvon7_3
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
0
|
||||
</AAA>
|
3
result/schematron/zvon7_3.err
Normal file
3
result/schematron/zvon7_3.err
Normal file
@ -0,0 +1,3 @@
|
||||
Pattern: Test integer
|
||||
/AAA line 1: O.K.
|
||||
./test/schematron/zvon7_3.xml fails to validate
|
4
result/schematron/zvon7_4
Normal file
4
result/schematron/zvon7_4
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
-45
|
||||
</AAA>
|
3
result/schematron/zvon7_4.err
Normal file
3
result/schematron/zvon7_4.err
Normal file
@ -0,0 +1,3 @@
|
||||
Pattern: Test integer
|
||||
/AAA line 1: O.K.
|
||||
./test/schematron/zvon7_4.xml fails to validate
|
9
result/schematron/zvon8_0
Normal file
9
result/schematron/zvon8_0
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<XXX>
|
||||
<BBB/>
|
||||
<BBB/>
|
||||
<AAA/>
|
||||
<BBB/>
|
||||
<AAA/>
|
||||
<AAA/>
|
||||
</XXX>
|
3
result/schematron/zvon8_0.err
Normal file
3
result/schematron/zvon8_0.err
Normal file
@ -0,0 +1,3 @@
|
||||
Pattern: Test count
|
||||
/XXX line 1: O.K.
|
||||
./test/schematron/zvon8_0.xml fails to validate
|
8
result/schematron/zvon8_1
Normal file
8
result/schematron/zvon8_1
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<XXX>
|
||||
<BBB/>
|
||||
<AAA/>
|
||||
<BBB/>
|
||||
<AAA/>
|
||||
<AAA/>
|
||||
</XXX>
|
3
result/schematron/zvon8_1.err
Normal file
3
result/schematron/zvon8_1.err
Normal file
@ -0,0 +1,3 @@
|
||||
Pattern: Test count
|
||||
/XXX line 1: Some BBB are missing
|
||||
./test/schematron/zvon8_1.xml fails to validate
|
8
result/schematron/zvon8_2
Normal file
8
result/schematron/zvon8_2
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<XXX>
|
||||
<BBB/>
|
||||
<BBB/>
|
||||
<AAA/>
|
||||
<BBB/>
|
||||
<AAA/>
|
||||
</XXX>
|
3
result/schematron/zvon8_2.err
Normal file
3
result/schematron/zvon8_2.err
Normal file
@ -0,0 +1,3 @@
|
||||
Pattern: Test count
|
||||
/XXX line 1: Some AAA are missing
|
||||
./test/schematron/zvon8_2.xml fails to validate
|
8
result/schematron/zvon9_0
Normal file
8
result/schematron/zvon9_0
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
<CCC/>
|
||||
<CCC/>
|
||||
<BBB>
|
||||
<CCC id="Q1"/>
|
||||
</BBB>
|
||||
</AAA>
|
2
result/schematron/zvon9_0.err
Normal file
2
result/schematron/zvon9_0.err
Normal file
@ -0,0 +1,2 @@
|
||||
Pattern: Test attribute
|
||||
./test/schematron/zvon9_0.xml validates
|
8
result/schematron/zvon9_1
Normal file
8
result/schematron/zvon9_1
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
<CCC id="Q2"/>
|
||||
<CCC/>
|
||||
<BBB>
|
||||
<CCC id="Q1"/>
|
||||
</BBB>
|
||||
</AAA>
|
3
result/schematron/zvon9_1.err
Normal file
3
result/schematron/zvon9_1.err
Normal file
@ -0,0 +1,3 @@
|
||||
Pattern: Test attribute
|
||||
/AAA/CCC[1] line 2: Attribute id is used in wrong context
|
||||
./test/schematron/zvon9_1.xml fails to validate
|
8
result/schematron/zvon9_2
Normal file
8
result/schematron/zvon9_2
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<AAA>
|
||||
<CCC/>
|
||||
<CCC/>
|
||||
<BBB>
|
||||
<CCC/>
|
||||
</BBB>
|
||||
</AAA>
|
3
result/schematron/zvon9_2.err
Normal file
3
result/schematron/zvon9_2.err
Normal file
@ -0,0 +1,3 @@
|
||||
Pattern: Test attribute
|
||||
/AAA/BBB/CCC line 5: Attribute id is missing
|
||||
./test/schematron/zvon9_2.xml fails to validate
|
47
schematron.c
47
schematron.c
@ -1224,6 +1224,29 @@ exit:
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
static xmlNodePtr
|
||||
xmlSchematronGetNode(xmlSchematronValidCtxtPtr ctxt,
|
||||
xmlNodePtr cur, const xmlChar *xpath) {
|
||||
xmlNodePtr node = NULL;
|
||||
xmlXPathObjectPtr ret;
|
||||
|
||||
if ((ctxt == NULL) || (cur == NULL) || (xpath == NULL))
|
||||
return(NULL);
|
||||
|
||||
ctxt->xctxt->doc = cur->doc;
|
||||
ctxt->xctxt->node = cur;
|
||||
ret = xmlXPathEval(xpath, ctxt->xctxt);
|
||||
if (ret == NULL)
|
||||
return(NULL);
|
||||
|
||||
if ((ret->type == XPATH_NODESET) &&
|
||||
(ret->nodesetval != NULL) && (ret->nodesetval->nodeNr > 0))
|
||||
node = ret->nodesetval->nodeTab[0];
|
||||
|
||||
xmlXPathFreeObject(ret);
|
||||
return(node);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlSchematronReportOutput:
|
||||
* @ctxt: the validation context
|
||||
@ -1255,7 +1278,7 @@ static xmlChar *
|
||||
xmlSchematronFormatReport(xmlSchematronValidCtxtPtr ctxt,
|
||||
xmlNodePtr test, xmlNodePtr cur) {
|
||||
xmlChar *ret = NULL;
|
||||
xmlNodePtr child;
|
||||
xmlNodePtr child, node;
|
||||
|
||||
if ((test == NULL) || (cur == NULL))
|
||||
return(ret);
|
||||
@ -1266,12 +1289,24 @@ xmlSchematronFormatReport(xmlSchematronValidCtxtPtr ctxt,
|
||||
(child->type == XML_CDATA_SECTION_NODE))
|
||||
ret = xmlStrcat(ret, child->content);
|
||||
else if (IS_SCHEMATRON(child, "name")) {
|
||||
if ((cur->ns == NULL) || (cur->ns->prefix == NULL))
|
||||
ret = xmlStrcat(ret, cur->name);
|
||||
xmlChar *path;
|
||||
|
||||
path = xmlGetNoNsProp(child, BAD_CAST "path");
|
||||
|
||||
node = cur;
|
||||
if (path != NULL) {
|
||||
node = xmlSchematronGetNode(ctxt, cur, path);
|
||||
if (node == NULL)
|
||||
node = cur;
|
||||
xmlFree(path);
|
||||
}
|
||||
|
||||
if ((node->ns == NULL) || (node->ns->prefix == NULL))
|
||||
ret = xmlStrcat(ret, node->name);
|
||||
else {
|
||||
ret = xmlStrcat(ret, cur->ns->prefix);
|
||||
ret = xmlStrcat(ret, node->ns->prefix);
|
||||
ret = xmlStrcat(ret, BAD_CAST ":");
|
||||
ret = xmlStrcat(ret, cur->name);
|
||||
ret = xmlStrcat(ret, node->name);
|
||||
}
|
||||
} else {
|
||||
child = child->next;
|
||||
@ -1358,7 +1393,7 @@ xmlSchematronReportSuccess(xmlSchematronValidCtxtPtr ctxt,
|
||||
} else {
|
||||
snprintf(msg, 999, "%s line %ld: %s\n", (const char *) path,
|
||||
line, (const char *) report);
|
||||
xmlFree(report);
|
||||
xmlFree((char *) report);
|
||||
}
|
||||
xmlSchematronReportOutput(ctxt, cur, &msg[0]);
|
||||
if ((path != NULL) && (path != (xmlChar *) cur->name))
|
||||
|
8
test/schematron/zvon11.sct
Normal file
8
test/schematron/zvon11.sct
Normal file
@ -0,0 +1,8 @@
|
||||
<schema xmlns="http://www.ascc.net/xml/schematron" >
|
||||
<pattern name="Attributes present">
|
||||
<rule context="BBB">
|
||||
<assert test="not(@aaa) or (@aaa and @bbb)">The element must not have an isolated aaa attribute</assert>
|
||||
<assert test="not(@bbb) or (@aaa and @bbb)">The element must not have an isolated bbb attribute</assert>
|
||||
</rule>
|
||||
</pattern>
|
||||
</schema>
|
3
test/schematron/zvon11_0.xml
Normal file
3
test/schematron/zvon11_0.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<AAA>
|
||||
<BBB aaa="A" bbb="B"/>
|
||||
</AAA>
|
3
test/schematron/zvon11_1.xml
Normal file
3
test/schematron/zvon11_1.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<AAA>
|
||||
<BBB bbb="B"/>
|
||||
</AAA>
|
3
test/schematron/zvon11_2.xml
Normal file
3
test/schematron/zvon11_2.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<AAA>
|
||||
<BBB aaa="A"/>
|
||||
</AAA>
|
3
test/schematron/zvon11_3.xml
Normal file
3
test/schematron/zvon11_3.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<AAA>
|
||||
<BBB/>
|
||||
</AAA>
|
8
test/schematron/zvon12.sct
Normal file
8
test/schematron/zvon12.sct
Normal file
@ -0,0 +1,8 @@
|
||||
<schema xmlns="http://www.ascc.net/xml/schematron" >
|
||||
<pattern name="Number of characters in an abbreviation">
|
||||
<rule context="BBB">
|
||||
<report test="string-length(@bbb) < 2">There is not enough letters in the abbreviation</report>
|
||||
<report test="string-length(@bbb) > 3">There is too much letters in the abbreviation</report>
|
||||
</rule>
|
||||
</pattern>
|
||||
</schema>
|
3
test/schematron/zvon12_0.xml
Normal file
3
test/schematron/zvon12_0.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<AAA>
|
||||
<BBB bbb="C"/>
|
||||
</AAA>
|
3
test/schematron/zvon12_1.xml
Normal file
3
test/schematron/zvon12_1.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<AAA>
|
||||
<BBB bbb="CZ"/>
|
||||
</AAA>
|
3
test/schematron/zvon12_2.xml
Normal file
3
test/schematron/zvon12_2.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<AAA>
|
||||
<BBB bbb="CZCZ"/>
|
||||
</AAA>
|
7
test/schematron/zvon13.sct
Normal file
7
test/schematron/zvon13.sct
Normal file
@ -0,0 +1,7 @@
|
||||
<schema xmlns="http://www.ascc.net/xml/schematron" >
|
||||
<pattern name="Sum equals 100%.">
|
||||
<rule context="Total">
|
||||
<assert test="sum(//Percent) = 100">The values do not sum to 100%. </assert>
|
||||
</rule>
|
||||
</pattern>
|
||||
</schema>
|
6
test/schematron/zvon13_0.xml
Normal file
6
test/schematron/zvon13_0.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<Total>
|
||||
<Percent>20</Percent>
|
||||
<Percent>30</Percent>
|
||||
<Percent>10</Percent>
|
||||
<Percent>50</Percent>
|
||||
</Total>
|
5
test/schematron/zvon13_1.xml
Normal file
5
test/schematron/zvon13_1.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<Total>
|
||||
<Percent>20</Percent>
|
||||
<Percent>10</Percent>
|
||||
<Percent>50</Percent>
|
||||
</Total>
|
5
test/schematron/zvon13_2.xml
Normal file
5
test/schematron/zvon13_2.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<Total>
|
||||
<Percent>20</Percent>
|
||||
<Percent>30</Percent>
|
||||
<Percent>50</Percent>
|
||||
</Total>
|
10
test/schematron/zvon14.sct
Normal file
10
test/schematron/zvon14.sct
Normal file
@ -0,0 +1,10 @@
|
||||
<schema xmlns="http://www.ascc.net/xml/schematron" >
|
||||
<pattern name="a child of selected elements">
|
||||
<rule context="CCC">
|
||||
<assert test="parent::*[name()='BBB' or name()='DDD']">Element CCC must not be a child of element
|
||||
<name path="parent::*"/>
|
||||
</assert>
|
||||
</rule>
|
||||
</pattern>
|
||||
</schema>
|
||||
|
12
test/schematron/zvon14_0.xml
Normal file
12
test/schematron/zvon14_0.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<AAA>
|
||||
<BBB>
|
||||
<CCC/>
|
||||
</BBB>
|
||||
<CCC/>
|
||||
<DDD>
|
||||
<CCC/>
|
||||
<EEE>
|
||||
<CCC/>
|
||||
</EEE>
|
||||
</DDD>
|
||||
</AAA>
|
11
test/schematron/zvon15.sct
Normal file
11
test/schematron/zvon15.sct
Normal file
@ -0,0 +1,11 @@
|
||||
<schema xmlns="http://www.ascc.net/xml/schematron" >
|
||||
<pattern name="id is the only permited attribute name">
|
||||
<rule context="*">
|
||||
<report test="@*[not(name()='id')]">Attribute
|
||||
<name path="@*[not(name()='id')]"/> is forbidden in element
|
||||
<name/>
|
||||
</report>
|
||||
</rule>
|
||||
</pattern>
|
||||
</schema>
|
||||
|
4
test/schematron/zvon15_0.xml
Normal file
4
test/schematron/zvon15_0.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<AAA name="aaa">
|
||||
<BBB id="bbb"/>
|
||||
<CCC color="ccc"/>
|
||||
</AAA>
|
10
test/schematron/zvon4.sct
Normal file
10
test/schematron/zvon4.sct
Normal file
@ -0,0 +1,10 @@
|
||||
<schema xmlns="http://www.ascc.net/xml/schematron" >
|
||||
<pattern name="Root test">
|
||||
<rule context="/*">
|
||||
<assert test="name()='AAA'">Root element is
|
||||
<name/>, not AAA
|
||||
</assert>
|
||||
<report test="name()='AAA'">Root element is AAA</report>
|
||||
</rule>
|
||||
</pattern>
|
||||
</schema>
|
6
test/schematron/zvon4_0.xml
Normal file
6
test/schematron/zvon4_0.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<AAA>
|
||||
<BBB>
|
||||
<CCC/>
|
||||
<CCC/>
|
||||
</BBB>
|
||||
</AAA>
|
6
test/schematron/zvon4_1.xml
Normal file
6
test/schematron/zvon4_1.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<XXX>
|
||||
<BBB>
|
||||
<CCC/>
|
||||
<CCC/>
|
||||
</BBB>
|
||||
</XXX>
|
12
test/schematron/zvon5.sct
Normal file
12
test/schematron/zvon5.sct
Normal file
@ -0,0 +1,12 @@
|
||||
<schema xmlns="http://www.ascc.net/xml/schematron" >
|
||||
<pattern name="Select empty elements CCC">
|
||||
<rule context="CCC">
|
||||
<assert test="normalize-space(.) and *">Source contains an empty element CCC </assert>
|
||||
<report test="normalize-space(.) = ''">[1]An element CCC does not contain any text</report>
|
||||
<assert test="normalize-space(.)">[2]An element CCC does not contain any text</assert>
|
||||
<report test="not(*)">[1]An element CCC does not contain any child element</report>
|
||||
<assert test="*">[2]An element CCC does not contain any child element</assert>
|
||||
</rule>
|
||||
</pattern>
|
||||
</schema>
|
||||
|
5
test/schematron/zvon5_0.xml
Normal file
5
test/schematron/zvon5_0.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<AAA>
|
||||
<BBB>
|
||||
<CCC/>
|
||||
</BBB>
|
||||
</AAA>
|
5
test/schematron/zvon5_1.xml
Normal file
5
test/schematron/zvon5_1.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<AAA>
|
||||
<BBB>
|
||||
<CCC>I am CCC element</CCC>
|
||||
</BBB>
|
||||
</AAA>
|
7
test/schematron/zvon5_2.xml
Normal file
7
test/schematron/zvon5_2.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<AAA>
|
||||
<BBB>
|
||||
<CCC>
|
||||
<DDD/>
|
||||
</CCC>
|
||||
</BBB>
|
||||
</AAA>
|
8
test/schematron/zvon6.sct
Normal file
8
test/schematron/zvon6.sct
Normal file
@ -0,0 +1,8 @@
|
||||
<schema xmlns="http://www.ascc.net/xml/schematron" >
|
||||
<pattern name="Predefined values">
|
||||
<rule context="AAA">
|
||||
<report test="normalize-space(.) = 'aaa' or normalize-space(.) = 'bbb'">O.K.</report>
|
||||
<assert test="normalize-space(.) = 'aaa' or normalize-space(.) = 'bbb'">The AAA value is not permitted.</assert>
|
||||
</rule>
|
||||
</pattern>
|
||||
</schema>
|
3
test/schematron/zvon6_0.xml
Normal file
3
test/schematron/zvon6_0.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<AAA>
|
||||
aaa
|
||||
</AAA>
|
3
test/schematron/zvon6_1.xml
Normal file
3
test/schematron/zvon6_1.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<AAA>
|
||||
bbb
|
||||
</AAA>
|
3
test/schematron/zvon6_2.xml
Normal file
3
test/schematron/zvon6_2.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<AAA>
|
||||
ccc
|
||||
</AAA>
|
9
test/schematron/zvon7.sct
Normal file
9
test/schematron/zvon7.sct
Normal file
@ -0,0 +1,9 @@
|
||||
<schema xmlns="http://www.ascc.net/xml/schematron" >
|
||||
<pattern name="Test integer">
|
||||
<rule context="AAA">
|
||||
<report test="floor(.) = number(.)">O.K.</report>
|
||||
<assert test="floor(.) = number(.)">The AAA value is not an integer.</assert>
|
||||
</rule>
|
||||
</pattern>
|
||||
</schema>
|
||||
|
3
test/schematron/zvon7_0.xml
Normal file
3
test/schematron/zvon7_0.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<AAA>
|
||||
aaa
|
||||
</AAA>
|
3
test/schematron/zvon7_1.xml
Normal file
3
test/schematron/zvon7_1.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<AAA>
|
||||
12.234
|
||||
</AAA>
|
3
test/schematron/zvon7_2.xml
Normal file
3
test/schematron/zvon7_2.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<AAA>
|
||||
45
|
||||
</AAA>
|
3
test/schematron/zvon7_3.xml
Normal file
3
test/schematron/zvon7_3.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<AAA>
|
||||
0
|
||||
</AAA>
|
3
test/schematron/zvon7_4.xml
Normal file
3
test/schematron/zvon7_4.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<AAA>
|
||||
-45
|
||||
</AAA>
|
10
test/schematron/zvon8.sct
Normal file
10
test/schematron/zvon8.sct
Normal file
@ -0,0 +1,10 @@
|
||||
<schema xmlns="http://www.ascc.net/xml/schematron" >
|
||||
<pattern name="Test count">
|
||||
<rule context="/*">
|
||||
<report test="count(//BBB) = count(//AAA)">O.K.</report>
|
||||
<assert test="count(//BBB) <= count(//AAA)">Some AAA are missing</assert>
|
||||
<report test="count(//BBB) < count(//AAA)">Some BBB are missing</report>
|
||||
</rule>
|
||||
</pattern>
|
||||
</schema>
|
||||
|
8
test/schematron/zvon8_0.xml
Normal file
8
test/schematron/zvon8_0.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<XXX>
|
||||
<BBB/>
|
||||
<BBB/>
|
||||
<AAA/>
|
||||
<BBB/>
|
||||
<AAA/>
|
||||
<AAA/>
|
||||
</XXX>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user