completed generate reader for xml