Example #1
0
        private static bool TryParseRss20Category(XElement categoryElement, out Rss20Category parsedCategory)
        {
            parsedCategory = default;

            if (categoryElement == null)
            {
                return(false);
            }

            parsedCategory        = new Rss20Category();
            parsedCategory.Name   = categoryElement.Value.Trim();
            parsedCategory.Domain = categoryElement.Attribute("domain")?.Value;

            return(true);
        }
Example #2
0
        private static bool TryFormatRss20Category(Rss20Category categoryToFormat, out XElement categoryElement)
        {
            categoryElement = default;

            if (categoryToFormat == null)
            {
                return(false);
            }

            if (!TryFormatOptionalTextElement(categoryToFormat.Name, "category", out categoryElement))
            {
                return(false);
            }

            if (TryFormatOptionalTextAttribute(categoryToFormat.Domain, "domain", out var categoryDomainAttribute))
            {
                categoryElement.Add(categoryDomainAttribute);
            }

            return(true);
        }