private static bool TryFormatMediaRssCopyright(MediaRssCopyright copyrightToFormat, out XElement copyrightElement) { copyrightElement = default; if (string.IsNullOrEmpty(copyrightToFormat?.Value)) { return(false); } copyrightElement = new XElement(_media + "copyright", copyrightToFormat.Value); if (!string.IsNullOrEmpty(copyrightToFormat.Url)) { copyrightElement.Add(new XAttribute("url", copyrightToFormat.Url)); } return(true); }
private static bool TryParseMediaRssCopyright(XElement copyrightElement, out MediaRssCopyright parsedCopyright) { parsedCopyright = default; if (string.IsNullOrWhiteSpace(copyrightElement?.Value)) { return(false); } parsedCopyright = new MediaRssCopyright { Value = copyrightElement.Value.Trim(), }; if (TryParseStringAttribute(copyrightElement.Attribute("url"), out var parsedUrl)) { parsedCopyright.Url = parsedUrl; } return(true); }