Updated XML validation and added tests.