refactor xml parser