protected internal virtual string ToSyndicationItemXml() { this.SyndicationItem.AttributeExtensions.Add(new XmlQualifiedName(SearchSettings.Config.SyndicationItemAttributeNameBoostFactor, SearchSettings.Config.XmlQualifiedNamespace), this.BoostFactor.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat)); this.SyndicationItem.AttributeExtensions.Add(new XmlQualifiedName(SearchSettings.Config.SyndicationItemAttributeNameType, SearchSettings.Config.XmlQualifiedNamespace), this.ItemType); this.SyndicationItem.AttributeExtensions.Add(new XmlQualifiedName(SearchSettings.Config.SyndicationItemAttributeNameCulture, SearchSettings.Config.XmlQualifiedNamespace), this.Culture); this.SyndicationItem.AttributeExtensions.Add(new XmlQualifiedName(SearchSettings.Config.SyndicationItemAttributeNameNamedIndex, SearchSettings.Config.XmlQualifiedNamespace), this.NamedIndex); this.SyndicationItem.AttributeExtensions.Add(new XmlQualifiedName(SearchSettings.Config.SyndicationItemAttributeNameReferenceId, SearchSettings.Config.XmlQualifiedNamespace), this.ReferenceId); this.SyndicationItem.AttributeExtensions.Add(new XmlQualifiedName(SearchSettings.Config.SyndicationItemAttributeNameItemStatus, SearchSettings.Config.XmlQualifiedNamespace), ((int)this.ItemStatus).ToString(System.Globalization.CultureInfo.InvariantCulture)); if (this.PublicationEnd.HasValue) { this.SyndicationItem.AttributeExtensions.Add(new XmlQualifiedName(SearchSettings.Config.SyndicationItemAttributeNamePublicationEnd, SearchSettings.Config.XmlQualifiedNamespace), this.PublicationEnd.Value.ToUniversalTime().ToString("u", System.Globalization.CultureInfo.InvariantCulture)); } if (this.PublicationStart.HasValue) { this.SyndicationItem.AttributeExtensions.Add(new XmlQualifiedName(SearchSettings.Config.SyndicationItemAttributeNamePublicationStart, SearchSettings.Config.XmlQualifiedNamespace), this.PublicationStart.Value.ToUniversalTime().ToString("u", System.Globalization.CultureInfo.InvariantCulture)); } if (this.DataUri != null) { this.SyndicationItem.AttributeExtensions.Add(new XmlQualifiedName(SearchSettings.Config.SyndicationItemAttributeNameDataUri, SearchSettings.Config.XmlQualifiedNamespace), this.DataUri.ToString()); } this.SyndicationItem.ElementExtensions.Add(new SyndicationElementExtension(SearchSettings.Config.SyndicationItemElementNameMetadata, SearchSettings.Config.XmlQualifiedNamespace, this.Metadata)); foreach (string current in from c in this.Categories where !string.IsNullOrEmpty(c) select c) { this.SyndicationItem.Categories.Add(new SyndicationCategory(current)); } foreach (string current2 in from a in this.Authors where !string.IsNullOrEmpty(a) select a) { this.SyndicationItem.Authors.Add(new SyndicationPerson("", current2, "")); } XNamespace ns = SearchSettings.Config.XmlQualifiedNamespace; XElement xElement = new XElement(ns + "ACL"); foreach (string current3 in IndexItemBase.RemoveDuplicates(this.AccessControlList)) { xElement.Add(new XElement(ns + "Item", current3)); } this.SyndicationItem.ElementExtensions.Add(xElement.CreateReader()); xElement = new XElement(ns + "VirtualPath"); foreach (string current4 in this.VirtualPathNodes) { xElement.Add(new XElement(ns + "Item", current4.Replace(" ", ""))); } this.SyndicationItem.ElementExtensions.Add(xElement.CreateReader()); var stringBuilder = new StringBuilder(); using (XmlWriter xmlWriter = XmlWriter.Create(stringBuilder, new XmlWriterSettings { CheckCharacters = false })) { this.SyndicationItem.GetAtom10Formatter().WriteTo(xmlWriter); } return(stringBuilder.ToString()); }
private static void AddAuthorsToIndexItem(SyndicationItem syndicationItem, IndexItemBase item) { if (syndicationItem.Authors != null) { foreach (SyndicationPerson current in syndicationItem.Authors) { item.Authors.Add(current.Name); } } }
private static void AddACLToIndexItem(SyndicationItem syndicationItem, IndexItemBase item) { Collection <XElement> collection = syndicationItem.ElementExtensions.ReadElementExtensions <XElement>(SearchSettings.Config.SyndicationItemElementNameAcl, SearchSettings.Config.XmlQualifiedNamespace); if (collection.Count > 0) { XElement xElement = collection.ElementAt(0); foreach (XElement current in xElement.Elements()) { item.AccessControlList.Add(current.Value); } } }
private static void AddCategoriesToIndexItem(SyndicationItem syndicationItem, IndexItemBase item) { if (syndicationItem.Categories != null) { foreach (SyndicationCategory current in syndicationItem.Categories) { item.Categories.Add(current.Name); } } }