/// <summary>takes the updated entry returned and sets the properties to this object</summary> /// <param name="updatedEntry"> </param> protected void CopyEntry(AtomEntry updatedEntry) { Tracing.Assert(updatedEntry != null, "updatedEntry should not be null"); if (updatedEntry == null) { throw new ArgumentNullException("updatedEntry"); } _title = updatedEntry.Title; _authors = updatedEntry.Authors; _id = updatedEntry.Id; _links = updatedEntry.Links; _lastUpdateDate = updatedEntry.Updated; _publicationDate = updatedEntry.Published; _authors = updatedEntry.Authors; _rights = updatedEntry.Rights; _categories = updatedEntry.Categories; _summary = updatedEntry.Summary; _content = updatedEntry.Content; _source = updatedEntry.Source; ExtensionElements.Clear(); foreach (IExtensionElementFactory extension in updatedEntry.ExtensionElements) { ExtensionElements.Add(extension); } }
///<summary>Standard type converter method</summary> public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, System.Type destinationType) { AtomTextConstruct tc = value as AtomTextConstruct; if (destinationType == typeof(System.String) && tc != null) { return(tc.Type + ": " + tc.Text); } return(base.ConvertTo(context, culture, value, destinationType)); }
/// <summary>parses an AtomTextConstruct</summary> /// <param name="reader">the xmlreader correctly positioned at the construct </param> /// <param name="owner">the container element</param> /// <returns>the new text construct </returns> protected AtomTextConstruct ParseTextConstruct(XmlReader reader, AtomBase owner) { Tracing.Assert(reader != null, "reader should not be null"); if (reader == null) { throw new ArgumentNullException("reader"); } if (owner == null) { throw new System.ArgumentNullException("owner"); } Tracing.TraceCall("Parsing atomTextConstruct"); AtomTextConstruct construct = owner.CreateAtomSubElement(reader, this) as AtomTextConstruct; if (reader.NodeType == XmlNodeType.Element) { if (reader.HasAttributes) { while (reader.MoveToNextAttribute()) { object attributeName = reader.LocalName; if (attributeName.Equals(_nameTable.Type)) { construct.Type = (AtomTextConstructType)Enum.Parse( typeof(AtomTextConstructType), Utilities.DecodedValue(reader.Value), true); } else { ParseBaseAttributes(reader, construct); } } } reader.MoveToElement(); switch (construct.Type) { case AtomTextConstructType.html: case AtomTextConstructType.text: construct.Text = Utilities.DecodedValue(reader.ReadString()); break; case AtomTextConstructType.xhtml: default: construct.Text = reader.ReadInnerXml(); break; } } return(construct); }