IssueID #1134: added basic top-down schema for dictionary datasets

This commit is contained in:
Cyprian Laskowski 2020-02-27 11:10:09 +01:00
parent 5a1b6e20bf
commit 1aad5017ed
2 changed files with 33 additions and 2 deletions

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/xml.xsd" />
<!-- top-level element is a dictionary -->
<xsd:element name="dictionary" type="dictionaryType"/>
<!-- top-level type consists of sequence of entries -->
<xsd:complexType name="dictionaryType">
<xsd:sequence>
<xsd:element name="entry" type="entryType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- entry consists of head and body -->
<xsd:complexType name="entryType">
<xsd:sequence>
<xsd:element name="head" type="xsd:anyType"/>
<xsd:element name="body" type="xsd:anyType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

View File

@ -4,14 +4,21 @@ script_dir="$(dirname "$(readlink -f "$0")")"
cd $script_dir
schema_dir=../resources/schema
top_schema=$schema_dir/top_dictionaries.xsd # for now we only have dictionaries
example_dir=../examples
for example_subdir in $example_dir/*
do
base=${example_subdir##*/}
schema=$schema_dir/$base.xsd
bottom_schema=$schema_dir/$base.xsd
for example_file in $example_subdir/*.xml
do
command="xmllint -schema $schema $example_file --noout"
command="xmllint -schema $top_schema $example_file --noout"
echo $command
if ! $command; then
exit 1
fi
command="xmllint -schema $bottom_schema $example_file --noout"
echo $command
if ! $command; then
exit 1