Пример #1
0
        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());
        }
Пример #2
0
        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);
        }
Пример #3
0
        //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());
        }
Пример #4
0
 private static JsonObject ReadExtensionAttribute(XAttribute attribute)
 {
     return(ReaderUtils.CreateExtension(attribute.Name.LocalName, attribute.BaseUri, attribute.Value));
 }
Пример #5
0
 private static JsonObject ReadExtension(KeyValuePair <XmlQualifiedName, string> pair)
 {
     return(ReaderUtils.CreateExtension(pair.Key.Name, pair.Key.Namespace, pair.Value));
 }