simplify xml parser code