Validate xml improvements

This will break backward compatibility, as it changes the function's return value from a bool_or_string to a (bool, ErrorLog) tuple. I think it's fair to say that the function was broken in the first place, so a backward incompatible change isn't horrible.
Made this change, pushed in next commit.