Что-то вроде этого может помочь (используя bash
):
# Iterate across the XSD files
for xsdfile in *.xsd
do
test -f "$xsdfile" || continue
# Strip the ".xsd" suffix and search for XML files matching this prefix
prefix="${xsdfile%.xsd}"
for xmlfile in "$xsdfile"_*.xml
do
test -f "$xmlfile" || continue
xmllint --noout --schema "$xsdfile" "$xmlfile"
done
done
Если вы хотите проверить все совпадающие файлы XML за одну операцию, это будет работать:
# Iterate across the XSD files
for xsdfile in *.xsd
do
test -f "$xsdfile" || continue
# Strip the ".xsd" suffix and search for XML files matching this prefix
prefix="${xsdfile%.xsd}"
for xmlfile in "$xsdfile"_*.xml
do
# Skip if no files, else do it just once
test -f "$xmlfile" || continue
xmllint --noout --schema "$xsdfile" "$xsdfile"_*.xml
break
done
done