I am having a problem with some XML print files where the source system omits to convert some characters to their XML syntax equivalent (e.g. & is not converted to &am
&am
If you just need to check validity(correctness) of any xml document using xmllint, here is one more way.
if xmllint --noout /tmp/test.xml > /dev/null 2>&1; then echo "correct" else echo "incorrect" fi