refactoring
check for invalid xml