public FakeCollectionCollection() { fake_collection = new CollectionCollection(); // ------------- Highest level ----------- FlickrNet.Collection colA = new Collection(); colA.Title = "Collection A"; colA.CollectionId = "A"; FlickrNet.Collection colB = new Collection(); colB.Title = "Collection B"; colB.CollectionId = "B"; fake_collection.Add(colA); fake_collection.Add(colB); // ------------ Second level -------------- FlickrNet.Collection colAA = new Collection(); colAA.Title = "Collection A.A"; colAA.CollectionId = "A.A"; FlickrNet.Collection colAB = new Collection(); colAB.Title = "Collection A.B"; colAB.CollectionId = "A.B"; colA.Collections.Add(colAA); colA.Collections.Add(colAB); // ------------ Photo sets --------------- CollectionSet ps1 = new CollectionSet(); ps1.SetId = "ps1"; ps1.Title = "PhotoSet 1"; CollectionSet ps2 = new CollectionSet(); ps2.SetId = "ps2"; ps2.Title = "PhotoSet 2"; colAA.Sets.Add(ps1); colB.Sets.Add(ps2); }
void IFlickrParsable.Load(XmlReader reader) { if (reader.LocalName != "collection") { UtilityMethods.CheckParsingException(reader); } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "id": CollectionId = reader.Value; break; case "title": Title = reader.Value; break; case "description": Description = reader.Value; break; case "iconlarge": IconLarge = reader.Value; break; case "iconsmall": IconSmall = reader.Value; break; case "url": Url = reader.Value; break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.MoveToElement(); // If this is an empty collection then skip to next item, which wont be a child, but may be a sibling. if (reader.IsEmptyElement) { reader.Skip(); return; } reader.Read(); while (reader.NodeType == XmlNodeType.Element && (reader.LocalName == "collection" || reader.LocalName == "set")) { if (reader.LocalName == "collection") { var c = new Collection(); ((IFlickrParsable)c).Load(reader); _subcollections.Add(c); } else { var s = new CollectionSet(); ((IFlickrParsable)s).Load(reader); _subsets.Add(s); } } // Skip to next element (if any) reader.Skip(); }
void IFlickrParsable.Load(XmlReader reader) { if (reader.LocalName != "collection") { UtilityMethods.CheckParsingException(reader); } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "id": CollectionId = reader.Value; break; case "title": Title = reader.Value; break; case "description": Description = reader.Value; break; case "iconlarge": IconLarge = reader.Value; break; case "iconsmall": IconSmall = reader.Value; break; case "url": Url = reader.Value; break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); while (reader.NodeType == XmlNodeType.Element && (reader.LocalName == "collection" || reader.LocalName == "set")) { if (reader.LocalName == "collection") { Collection c = new Collection(); ((IFlickrParsable)c).Load(reader); subcollections.Add(c); } else { CollectionSet s = new CollectionSet(); ((IFlickrParsable)s).Load(reader); subsets.Add(s); } } // Skip to next element (if any) reader.Skip(); }
void IFlickrParsable.Load(XmlReader reader) { if (!(reader.LocalName != "collection")) ; while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "id": this.CollectionId = reader.Value; continue; case "title": this.Title = reader.Value; continue; case "description": this.Description = reader.Value; continue; case "iconlarge": this.IconLarge = reader.Value; continue; case "iconsmall": this.IconSmall = reader.Value; continue; case "url": this.Url = reader.Value; continue; default: continue; } } reader.MoveToElement(); if (reader.IsEmptyElement) { reader.Skip(); } else { reader.Read(); while (reader.NodeType == XmlNodeType.Element && (reader.LocalName == "collection" || reader.LocalName == "set")) { if (reader.LocalName == "collection") { Collection collection = new Collection(); collection.Load(reader); this.subcollections.Add(collection); } else { CollectionSet collectionSet = new CollectionSet(); collectionSet.Load(reader); this.subsets.Add(collectionSet); } } reader.Skip(); } }
void IFlickrParsable.Load(XmlReader reader) { if (reader.LocalName != "collection") UtilityMethods.CheckParsingException(reader); while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "id": CollectionId = reader.Value; break; case "title": Title = reader.Value; break; case "description": Description = reader.Value; break; case "iconlarge": IconLarge = reader.Value; break; case "iconsmall": IconSmall = reader.Value; break; case "url": Url = reader.Value; break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.MoveToElement(); // If this is an empty collection then skip to next item, which wont be a child, but may be a sibling. if (reader.IsEmptyElement) { reader.Skip(); return; } reader.Read(); while (reader.NodeType == XmlNodeType.Element && (reader.LocalName == "collection" || reader.LocalName == "set")) { if (reader.LocalName == "collection") { var c = new Collection(); ((IFlickrParsable)c).Load(reader); _subcollections.Add(c); } else { var s = new CollectionSet(); ((IFlickrParsable)s).Load(reader); _subsets.Add(s); } } // Skip to next element (if any) reader.Skip(); }
void IFlickrParsable.Load(XmlReader reader) { if (reader.LocalName != "collection") UtilityMethods.CheckParsingException(reader); while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "id": CollectionId = reader.Value; break; case "title": Title = reader.Value; break; case "description": Description = reader.Value; break; case "iconlarge": IconLarge = reader.Value; break; case "iconsmall": IconSmall = reader.Value; break; case "url": Url = reader.Value; break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); while (reader.NodeType == XmlNodeType.Element && (reader.LocalName == "collection" || reader.LocalName == "set")) { if (reader.LocalName == "collection") { Collection c = new Collection(); ((IFlickrParsable)c).Load(reader); subcollections.Add(c); } else { CollectionSet s = new CollectionSet(); ((IFlickrParsable)s).Load(reader); subsets.Add(s); } } // Skip to next element (if any) reader.Skip(); }