Sdl.Web.Common.Models.MediaItem.ReadFromXhtmlElement C# (CSharp) Method

ReadFromXhtmlElement() public method

Read properties from XHTML element.
public ReadFromXhtmlElement ( XmlElement xhtmlElement ) : void
xhtmlElement System.Xml.XmlElement XHTML element
return void
        public virtual void ReadFromXhtmlElement(XmlElement xhtmlElement)
        {
            // Return the Item (Reference) ID part of the TCM URI.
            Id = xhtmlElement.GetAttribute("xlink:href").Split('-')[1];
            Url = xhtmlElement.GetAttribute("src");
            string htmlClasses = xhtmlElement.GetAttribute("class").Trim();
            if (!string.IsNullOrEmpty(htmlClasses))
            {
                HtmlClasses = htmlClasses;
            }
            FileName = xhtmlElement.GetAttribute("data-multimediaFileName");
            string size = xhtmlElement.GetAttribute("data-multimediaFileSize");
            if (!String.IsNullOrEmpty(size))
            {
                FileSize = Convert.ToInt64(size);
            }
            MimeType = xhtmlElement.GetAttribute("data-multimediaMimeType");
            IsEmbedded = true;
        }