private void WriteCategory(string name, SyndicationWriter writer, Category category) { writer.WriteStartElement(name); writer.WriteAttributeString("term", category.Term); if (category.Label != null) writer.WriteAttributeString("label", category.Label); if (category.SchemeUrl != null) { writer.WriteStartAttribute("scheme"); writer.WriteValue(category.SchemeUrl); writer.WriteEndAttribute(); } writer.WriteEndElement(); }
private void WriteContent(string name, SyndicationWriter writer, Content content) { writer.WriteStartElement(name); writer.WriteAttributeString("type", content.Type); // checks which to write to the output of the content // you can either write a source URL or text, but not both if (content.SourceUrl != null) { writer.WriteStartAttribute("src"); writer.WriteValue(content.SourceUrl); writer.WriteEndAttribute(); } else { writer.WriteString(content.InnerText); } writer.WriteEndElement(); }
private void WriteLink(string name, SyndicationWriter writer, Link link) { writer.WriteStartElement(name); writer.WriteStartAttribute("href"); writer.WriteValue(link.Href); writer.WriteEndAttribute(); if (link.Relationship != LinkRelationship.NotDefined) writer.WriteAttributeString("rel", link.Relationship.ToString().ToLower()); if (link.Type != null) writer.WriteAttributeString("type", link.Type); if (link.Language != null) writer.WriteAttributeString("hreflang", link.Language); if (link.Title != null) writer.WriteAttributeString("title", link.Title); if (link.Length.HasValue) writer.WriteAttributeString("length", link.Length.Value.ToString()); writer.WriteEndElement(); }
private void WriteGenerator(string name, SyndicationWriter writer, Generator generator) { writer.WriteStartElement(name); writer.WriteStartAttribute("uri"); writer.WriteValue(generator.Url); writer.WriteEndAttribute(); writer.WriteStartAttribute("version"); writer.WriteString(generator.Version.ToString()); writer.WriteEndAttribute(); writer.WriteString(generator.InnerText); writer.WriteEndElement(); }