private static Album CreateAlbum(XmlReader reader) { var albumName = reader.ReadElementContentAsString(); var album = new Album() { Name = albumName }; return album; }
private static void ReadBandName(XmlReader reader, IDictionary<string, Band> bandsByName, Album album) { reader.ReadToFollowing("band"); var bandName = reader.ReadElementContentAsString().Trim(); if (!bandsByName.ContainsKey(bandName)) { bandsByName[bandName] = new Band() { Name = bandName }; } bandsByName[bandName].Albums.Add(album); }
private static void ReadAuthors(XmlReader reader, Album album) { reader.ReadToFollowing("artists"); if (reader.ReadToDescendant("artist")) { do { var artistName = reader.ReadElementContentAsString(); album.Authors.Add(artistName); } while (reader.ReadToNextSibling("artist")); } }