validate-docx.sh: print list of files that fail validation.

This commit is contained in:
John MacFarlane
2023-12-18 12:21:00 -08:00
parent 0849baef1e
commit 4db6661fe5
+10 -1
View File
@@ -3,8 +3,10 @@
# to look at more files than just document.xml.
# Further modified by jgm for portability.
tmpdir=$(mktemp -d)
error_files=""
errors=0
for file in "$@"; do
file_errors=0
echo "*** Checking $file"
rm -rf "$tmpdir"
unzip -q -o -j "$file" -d "$tmpdir"
@@ -15,7 +17,14 @@ for file in "$@"; do
for i in "$tmpdir"/*-pretty.xml; do
xmllint -noout -nonet \
-schema "${XSD}" \
"${i}" 2>&1 || errors=$((errors + 1))
"${i}" 2>&1 || file_errors=$((file_errors + 1))
done
if [ $file_errors -gt 0 ]; then
errors=$((file_errors + errors))
error_files="$error_files\n$file"
fi
done
if [ $errors -gt 0 ]; then
echo "These files failed validation:$error_files"
fi
exit $errors