Refactoring xmlparser