private static JsonObject[] GetTitleExtensions(TextSyndicationContent title) { List <JsonObject> extensions = new List <JsonObject>(); extensions.Add(ReaderUtils.CreateExtension("type", null, title.Type)); extensions.AddRange(title.AttributeExtensions.Select(pair => ReadExtension(pair))); return(extensions.ToArray()); }
private static JsonObject ReadExtensionElement(XElement element) { JsonObject jsonObject = ReaderUtils.CreateExtension(element.Name.LocalName, element.BaseUri, null); jsonObject.Remove("value"); jsonObject["attributes"] = ReadExtensionAttributes(element); jsonObject["children"] = element.Elements().Select(child => ReadExtensionElement(element)).ToArray(); return(jsonObject); }
//TODO refactor the extraction of extensions into extension elements and extension attribute methods. private static JsonObject[] GetLinkExtensions(SyndicationLink link) { List <JsonObject> extensions = new List <JsonObject>(); //TODO: fix the inclusion of title as extension. Title attribute is not required in the link element and its //inclusion as an extension should be tested for the precesence of the attribute in the xml element. Unfortunately, //SyndicationLink doesn't allow for accessing the underlying XML document.. perhaps using an AtomFormatter10?? extensions.Add(ReaderUtils.CreateExtension("title", null, link.Title)); extensions.AddRange(link.AttributeExtensions.Select(pair => ReadExtension(pair))); return(extensions.ToArray()); }
private static JsonObject ReadExtensionAttribute(XAttribute attribute) { return(ReaderUtils.CreateExtension(attribute.Name.LocalName, attribute.BaseUri, attribute.Value)); }
private static JsonObject ReadExtension(KeyValuePair <XmlQualifiedName, string> pair) { return(ReaderUtils.CreateExtension(pair.Key.Name, pair.Key.Namespace, pair.Value)); }