ci(xml): xml validation

This commit is contained in:
Lewis Wynne 2026-03-23 21:11:49 +00:00
parent 45c8f23097
commit 0379a3ccff
3 changed files with 92 additions and 1 deletions

27
scripts/validate-xml.sh Executable file
View file

@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail
schema_dir="data/schema"
fail=0
validate() {
local schema="$1" file="$2"
if xmllint --noout --schema "$schema" "$file" 2>&1; then
:
else
fail=1
fi
}
for f in data/species/*.xml; do
validate "$schema_dir/species.xsd" "$f"
done
validate "$schema_dir/citizenships.xsd" data/citizenships.xml
validate "$schema_dir/languages.xsd" data/languages.xml
for f in data/templates/*.xml; do
validate "$schema_dir/template.xsd" "$f"
done
exit $fail