xml_schemas/scripts/validate_examples

31 lines
947 B
Plaintext
Raw Permalink Normal View History

#!/bin/bash
script_dir="$(dirname "$(readlink -f "$0")")"
cd $script_dir
schema_dir=../resources/schema
top_schema=$schema_dir/top_dictionaries.xsd
dictionary_types=("bilingual_dictionaries collocation_dictionary monolingual_dictionaries morphological_lexicon valency_lexicon")
example_dir=../examples
for example_subdir in $example_dir/*
do
base=${example_subdir##*/}
bottom_schema=$schema_dir/$base.xsd
for example_file in $example_subdir/*.xml
do
case $base in bilingual_dictionaries|collocation_dictionary|monolingual_dictionaries|morphological_lexicon|valency_lexicon)
command="xmllint -schema $top_schema $example_file --noout"
echo $command
if ! $command; then
exit 1
fi
esac
command="xmllint -schema $bottom_schema $example_file --noout"
echo $command
if ! $command; then
exit 1
fi
done
done