void IFlickrParsable.Load(System.Xml.XmlReader reader) { if (reader.LocalName != "stats") { UtilityMethods.CheckParsingException(reader); } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "views": Views = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; case "comments": Comments = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; case "favorites": Favorites = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Skip(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { Load(reader, false); if (reader.LocalName != "stats") { UtilityMethods.CheckParsingException(reader); } while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "views": StatViews = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; case "comments": StatComments = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; case "favorites": StatFavorites = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); if (reader.LocalName == "description") Description = reader.ReadElementContentAsString(); reader.Skip(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "id": LicenseId = (LicenseType)reader.ReadContentAsInt(); break; case "name": LicenseName = reader.Value; break; case "url": if (!string.IsNullOrEmpty(reader.Value)) { LicenseUrl = reader.Value; } break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { if (reader.LocalName != "place_type") UtilityMethods.CheckParsingException(reader); while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "place_type_id": case "id": Id = reader.ReadContentAsInt(); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); Name = reader.ReadContentAsString(); reader.Skip(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "usage": Usage = reader.ReadContentAsInt(); break; case "predicate": PredicateName = reader.Value; break; case "namespace": NamespaceName = reader.Value; break; } } reader.Read(); if (reader.NodeType == System.Xml.XmlNodeType.Text) PairName = reader.ReadContentAsString(); reader.Read(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "usage": Usage = reader.ReadContentAsInt(); break; case "predicate": PredicateName = reader.Value; break; case "namespace": NamespaceName = reader.Value; break; case "first_added": DateFirstAdded = UtilityMethods.UnixTimestampToDate(reader.Value); break; case "last_added": DateLastUsed = UtilityMethods.UnixTimestampToDate(reader.Value); break; } } reader.Read(); if (reader.NodeType == System.Xml.XmlNodeType.Text) ValueText = reader.ReadContentAsString(); reader.Read(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { if (reader.LocalName != "referrer") UtilityMethods.CheckParsingException(reader); while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "url": Url = reader.Value; break; case "searchterm": SearchTerm = reader.Value; break; case "views": Views = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Skip(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "ready": Ready = reader.Value == "1"; break; case "failed": Failed = reader.Value == "1"; break; case "pending": Pending = reader.Value == "1"; break; case "duration": Duration = string.IsNullOrEmpty(reader.Value) ? -1 : reader.ReadContentAsInt(); break; case "width": Width = string.IsNullOrEmpty(reader.Value) ? -1 : reader.ReadContentAsInt(); break; case "height": Height = string.IsNullOrEmpty(reader.Value) ? -1 : reader.ReadContentAsInt(); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { if (reader.LocalName != "blog") UtilityMethods.CheckParsingException(reader); while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "id": BlogId = reader.Value; break; case "name": BlogName = reader.Value; break; case "url": BlogUrl = reader.Value; break; case "needspassword": NeedsPassword = reader.Value == "1"; break; case "service": Service = reader.Value; break; default: UtilityMethods.CheckParsingException(reader); break; } } }
/// <summary>Initializes a new instance of RssEnclosure</summary> public RssEnclosure (System.Xml.XmlReader xmlTextReader) { System.Diagnostics.Debug.Assert(xmlTextReader.HasAttributes); // while(xmlTextReader.MoveToNextAttribute()) { XmlSerializationUtil.DecodeXmlTextReaderValue(this, xmlTextReader); } }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { if (reader.LocalName != "photoset") Helper.CheckParsingException(reader); while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "id": PhotosetId = reader.Value; break; case "primary": PrimaryPhotoId = reader.Value; break; case "owner": OwnerId = reader.Value; break; case "ownername": OwnerName = reader.Value; break; case "page": Page = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; case "total": Total = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; case "pages": Pages = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; case "perpage": case "per_page": PerPage = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; case "title": Title = reader.Value; break; default: Helper.CheckParsingException(reader); break; } } reader.Read(); while (reader.LocalName == "photo") { Photo photo = new Photo(); ((IFlickrParsable)photo).Load(reader); if (String.IsNullOrEmpty(photo.UserId)) photo.UserId = OwnerId; Add(photo); } reader.Skip(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { if (reader == null) throw new ArgumentNullException("reader"); if (!reader.ReadToFollowing("photos")) throw new ResponseXmlException("Unable to find \"photos\" element in response."); while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "maxdisplaypx": MaximumDisplayPixels = reader.ReadContentAsInt(); break; case "maxupload": MaximumPhotoUpload = reader.ReadContentAsLong(); break; default: UtilityMethods.CheckParsingException(reader); break; } } if (!reader.ReadToFollowing("videos")) throw new ResponseXmlException("Unable to find \"videos\" element in response."); while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "maxduration": MaximumVideoDuration = reader.ReadContentAsInt(); break; case "maxupload": MaximumVideoUpload = reader.ReadContentAsLong(); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Skip(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "nsid": InstitutionId = reader.Value; break; case "date_launch": DateLaunched = UtilityMethods.UnixTimestampToDate(reader.Value); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); while (reader.NodeType != System.Xml.XmlNodeType.EndElement) { switch (reader.LocalName) { case "name": InstitutionName = reader.ReadElementContentAsString(); break; case "urls": reader.Read(); while (reader.LocalName == "url") { string type = reader.GetAttribute("type"); string url = reader.ReadElementContentAsString(); switch (type) { case "site": SiteUrl = url; break; case "flickr": FlickrUrl = url; break; case "license": LicenseUrl = url; break; } } reader.Read(); break; } } reader.Read(); }
/// <summary>Initializes a new instance of RssGuid</summary> public RssGuid (System.Xml.XmlReader xmlTextReader): this() { bool emptyElement = xmlTextReader.IsEmptyElement; while(xmlTextReader.MoveToNextAttribute()) { XmlSerializationUtil.DecodeXmlTextReaderValue(this, xmlTextReader); } if(emptyElement) return; // xmlTextReader.MoveToElement(); XmlSerializationUtil.DecodeXmlTextReaderValue(this,this.GetType().GetProperty("Value"), xmlTextReader); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { if (reader.LocalName != "comment") UtilityMethods.CheckParsingException(reader); while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "id": CommentId = reader.Value; break; case "author": AuthorUserId = reader.Value; break; case "authorname": AuthorUserName = reader.Value; break; case "permalink": Permalink = reader.Value; break; case "datecreate": DateCreated = UtilityMethods.UnixTimestampToDate(reader.Value); break; case "iconserver": IconServer = reader.Value; break; case "iconfarm": IconFarm = reader.Value; break; case "path_alias": Path_Alias = reader.Value; break; case "realname": RealName = reader.Value; break; case "author_is_deleted": Author_Is_Deleted = reader.Value == "1" ? true: false; break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); CommentHtml = reader.ReadContentAsString(); reader.Skip(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { if (reader.LocalName != "contact") UtilityMethods.CheckParsingException(reader); while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "nsid": UserId = reader.Value; break; case "username": UserName = reader.Value; break; case "iconserver": IconServer = reader.Value; break; case "iconfarm": IconFarm = reader.Value; break; case "ignored": IsIgnored = reader.Value == "0"; break; case "realname": RealName = reader.Value; break; case "location": Location = reader.Value; break; case "friend": IsFriend = reader.Value == "1"; break; case "family": IsFamily = reader.Value == "1"; break; case "path_alias": PathAlias = reader.Value; break; case "photos_uploaded": PhotosUploaded = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Skip(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "id": case "nsid": UserId = reader.Value; break; case "iconserver": IconServer = reader.Value; break; case "iconfarm": IconFarm = reader.Value; break; case "username": UserName = reader.Value; break; case "realname": RealName = reader.Value; break; case "added_by": AddedByUserId = reader.Value; break; case "path_alias": PathAlias = reader.Value; break; case "x": PositionX = reader.ReadContentAsInt(); break; case "y": PositionY = reader.ReadContentAsInt(); break; case "w": PositionWidth = reader.ReadContentAsInt(); break; case "h": PositionHeight = reader.ReadContentAsInt(); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { if (reader.LocalName != "exif") UtilityMethods.CheckParsingException(reader); while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "tagspace": TagSpace = reader.Value; break; case "tagspaceid": TagSpaceId = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo); break; case "tag": Tag = reader.Value; break; case "label": Label = reader.Value; break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); while (reader.LocalName != "exif") { switch (reader.LocalName) { case "raw": Raw = reader.ReadElementContentAsString(); break; case "clean": Clean = reader.ReadElementContentAsString(); break; default: UtilityMethods.CheckParsingException(reader); reader.Skip(); break; } } reader.Read(); }
public void ReadXml(System.Xml.XmlReader reader) { bool isEmpty = reader.IsEmptyElement; if (reader.HasAttributes) { for (int i = 0; i < reader.AttributeCount; i++) { reader.MoveToNextAttribute(); if (reader.NamespaceURI == "") { if (reader.LocalName == "ref") { this.Ref = reader.Value; } else if (reader.LocalName == "href") { this.Href = new Uri(reader.Value); } else if (reader.LocalName == "source") { this.Source = new Uri(reader.Value); } else if (reader.LocalName == "type") { this.MediaType = reader.Value; } else { this.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), reader.Value); } } } } reader.ReadStartElement(); if (!isEmpty) { while (reader.IsStartElement()) { ElementExtensions.Add((XElement) XElement.ReadFrom(reader)); } reader.ReadEndElement(); } }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { if (reader.LocalName != "category") UtilityMethods.CheckParsingException(reader); while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "name": CategoryName = reader.Value; break; case "path": Path = reader.Value; break; case "pathids": PathIds = reader.Value; break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); while (reader.LocalName == "subcat" || reader.LocalName == "group") { if (reader.LocalName == "subcat") { Subcategory c = new Subcategory(); ((IFlickrParsable)c).Load(reader); Subcategories.Add(c); } else { Group s = new Group(); ((IFlickrParsable)s).Load(reader); Groups.Add(s); } } // Skip to next element (if any) reader.Skip(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "label": Label = reader.Value; break; case "offset": Offset = reader.Value; break; } } reader.Skip(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "nsid": UserId = reader.Value; break; case "geoperms": GeoPermissions = (GeoPermissionType)reader.ReadContentAsInt(); break; case "importgeoexif": ImportGeoExif = reader.Value == "1"; break; } } }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "score": Score = reader.ReadContentAsInt(); break; } } reader.Read(); if (reader.NodeType == System.Xml.XmlNodeType.Text) Tag = reader.ReadContentAsString(); reader.Read(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "href": Href = reader.Value; break; case "type": Type = reader.Value; break; case "date": Date = DateTime.Parse(reader.Value, System.Globalization.DateTimeFormatInfo.CurrentInfo, System.Globalization.DateTimeStyles.None); break; } } reader.Read(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { if (reader.LocalName != "note") UtilityMethods.CheckParsingException(reader); while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "id": NoteId = reader.Value; break; default: UtilityMethods.CheckParsingException(reader); break; } } }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "ready": Ready = reader.Value == "1"; break; case "failed": Failed = reader.Value == "1"; break; case "pending": Pending = reader.Value == "1"; break; case "duration": if (String.IsNullOrEmpty(reader.Value)) Duration = -1; else Duration = reader.ReadContentAsInt(); break; case "width": if (String.IsNullOrEmpty(reader.Value)) Width = -1; else Width = reader.ReadContentAsInt(); break; case "height": if (String.IsNullOrEmpty(reader.Value)) Height = -1; else Height = reader.ReadContentAsInt(); break; default: Helper.CheckParsingException(reader); break; } } reader.Read(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { if (reader.LocalName != "subscription") UtilityMethods.CheckParsingException(reader); while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "topic": Topic = reader.Value; break; case "callback": Callback = reader.Value; break; case "pending": IsPending = reader.Value == "1"; break; case "date_create": DateCreated = UtilityMethods.UnixTimestampToDate(reader.Value); break; case "lease_seconds": LeaseSeconds = reader.ReadContentAsInt(); break; case "expiry": Expiry = UtilityMethods.UnixTimestampToDate(reader.Value); break; case "verify_attempts": VerifyAttempts = reader.ReadContentAsInt(); break; default: UtilityMethods.CheckParsingException(reader); break; } } reader.Read(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { Tags = new Collection<string>(); while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "total": TotalTags = reader.ReadContentAsInt(); break; } } reader.Read(); while (reader.LocalName == "tag") { Tags.Add(reader.ReadElementContentAsString()); } reader.Read(); }
void IFlickrParsable.Load(System.Xml.XmlReader reader) { while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "id": TicketId = reader.Value; break; case "invalid": InvalidTicketId = true; break; case "photoid": PhotoId = reader.Value; break; case "complete": CompleteStatus = reader.ReadContentAsInt(); break; } } reader.Skip(); }
/// <summary>Initializes a new instance of RssCloud</summary> public RssCloud (System.Xml.XmlReader xmlTextReader) { if(!xmlTextReader.HasAttributes) return; // System.Reflection.PropertyInfo propertyInfo = null; // while(xmlTextReader.MoveToNextAttribute()) { // find related property by name propertyInfo = GetType().GetProperty(xmlTextReader.Name, System.Reflection.BindingFlags.IgnoreCase | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance); if(propertyInfo!=null) { // Protocol enum needs some conversion before the typeconverter can set the values that contains - char if(propertyInfo.Name == "Protocol") { propertyInfo.SetValue(this, System.ComponentModel.TypeDescriptor.GetConverter(propertyInfo.PropertyType).ConvertFromString(xmlTextReader.ReadInnerXml().Trim().Replace("-","")),null); } else { XmlSerializationUtil.DecodeXmlTextReaderValue(this, xmlTextReader); } } } }