refactor XmlReader