Refactoring and creating an XML Parser class