Modified so that it can be used to validate xml