#!/usr/bin/env bash
if [[ $# != 1 ]]; then
    echo "USAGE: $(basename "$0") <input_file>"
    exit 1
fi

FILE1=$1

if [[ ! -e $FILE1 ]]; then
    echo "ERROR: '$1' file not found"
    exit 1
fi

# xsd is a non-final command, so just treated as a warning when compiling:
xmllint --schema "/usr/local"/share/lttoolbox/dix.xsd --noout "$FILE1" 2>&1 | grep -ve ' validates$' -e ' fails to validate$'
xmllint --dtdvalid "/usr/local"/share/lttoolbox/dix.dtd --noout "$FILE1"
