private static bool TryParseMediaRssCredit(XElement creditElement, out MediaRssCredit parsedCredit) { parsedCredit = default; if (string.IsNullOrWhiteSpace(creditElement?.Value)) { return(false); } parsedCredit = new MediaRssCredit { Value = creditElement.Value.Trim(), }; if (TryParseStringAttribute(creditElement.Attribute("role"), out var parsedRole)) { parsedCredit.Role = parsedRole; } if (TryParseStringAttribute(creditElement.Attribute("scheme"), out var parsedScheme)) { parsedCredit.Scheme = parsedScheme; } return(true); }
private static bool TryFormatMediaRssCredit(MediaRssCredit creditToFormat, out XElement creditElement) { creditElement = default; if (string.IsNullOrEmpty(creditToFormat?.Value)) { return(false); } creditElement = new XElement(_media + "credit", creditToFormat.Value); if (!string.IsNullOrEmpty(creditToFormat.Role)) { creditElement.Add(new XAttribute("role", creditToFormat.Role)); } if (!string.IsNullOrEmpty(creditToFormat.Scheme) && creditToFormat.Scheme != "urn:ebu") { creditElement.Add(new XAttribute("scheme", creditToFormat.Scheme)); } return(true); }