private static bool TryParseRss20Source(XElement sourceElement, out Rss20Source parsedSource) { parsedSource = default; if (sourceElement == null) { return(false); } parsedSource = new Rss20Source(); parsedSource.Name = sourceElement.Value.Trim(); parsedSource.Url = sourceElement.Attribute("url")?.Value; return(true); }
private static bool TryFormatRss20Source(Rss20Source sourceToFormat, out XElement sourceElement) { sourceElement = default; if (sourceToFormat == null) { return(false); } if (!TryFormatOptionalTextElement(sourceToFormat.Name, "source", out sourceElement)) { return(false); } if (TryFormatOptionalTextAttribute(sourceToFormat.Url, "url", out var sourceUrlAttribute)) { sourceElement.Add(sourceUrlAttribute); } return(true); }