// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// Adds a media group to the item. /// </summary> /// <param name="mg">RssMediaGroup</param> // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- public void AddMediaGroup(RssMediaGroup mg) { mg.Parent = this; for (int i = 0; i < mg.mediaContentItems.Count; i++) { // set parent mg.mediaContentItems[i].Parent = mg; } // now add to the media groups mediaGroups.Add(mg); }
// ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- /// <summary> /// Loads the RssItem object from the XElement /// </summary> /// <param name="el">Current Element</param> private new void LoadEl(XElement el) { // if the el is a core element, load from the base if (el.Name.Namespace == XNamespace.None) { base.LoadEl(el); } // if the el is in the media namespace or the dublin core terms namespace, load what we know. else if (el.Name.Namespace == RSS.MEDIA_NS || el.Name.Namespace == RSS.DUBLIN_CORE_TERMS_NS) { switch (el.Name.LocalName) { case RssMediaGroup.TAG_PARENT: RssMediaGroup mediaGroup = new RssMediaGroup(this); mediaGroup.Load(el); mediaGroups.Add(mediaGroup); break; case RssMediaContent.TAG_PARENT: RssMediaContent mediaContent = new RssMediaContent(this); mediaContent.Load(el); mediaContentItems.Add(mediaContent); break; default: mediaOptions.LoadEl(el); break; } } // if the element is in the DublinCoreNS, load what we know else if (el.Name.Namespace == RSS.DUBLIN_CORE_NS) { switch (el.Name.LocalName) { case RssDublinCoreCreator.TAG_PARENT: RssDublinCoreCreator creator = new RssDublinCoreCreator(); creator.Load(el); creators.Add(creator); break; } } // is the element in the Content Namespace, if so, process it else if (el.Name.Namespace == RSS.CONTENT_NS) { switch (el.Name.LocalName) { case RssContentEncoded.TAG_PARENT: ContentEncoded = new RssContentEncoded(); ContentEncoded.Load(el); break; } } else if (el.Name.Namespace == RSS.SLASH_NS) { switch (el.Name.LocalName) { case RssSlashComments.TAG_PARENT: SlashComments = new RssSlashComments(); SlashComments.Load(el); break; } } else if (el.Name.Namespace == RSS.CREATIVE_COMMONS_NS) { switch (el.Name.LocalName) { case RssCreativeCommonsLicense.TAG_PARENT: CreativeCommonsLicense = new RssCreativeCommonsLicense(); CreativeCommonsLicense.Load(el); break; } } }