xml parser refactored