public string RetornarContenidoFeed(SyndicationContent feedItemContent)
        {
            string rpta = string.Empty;

            try
            {
                MemoryStream ms = new MemoryStream();
                XmlWriterSettings ws = new XmlWriterSettings
                {
                    Indent = true,
                    IndentChars = " ",
                    OmitXmlDeclaration = true,
                    Encoding = new UTF8Encoding(false),
                };
                XmlWriter w = XmlWriter.Create(ms, ws);
                feedItemContent.WriteTo(w, "Content", "");
                w.Flush();
                String texto = Encoding.UTF8.GetString(ms.ToArray(), 0, ms.ToArray().Length);

                texto = texto.Replace("<br />", "\n");
                //texto = HttpUtility.HtmlDecode(texto);
                //rpta = HttpUtility.HtmlDecode(ExtractText(texto));
                rpta = HttpUtility.HtmlDecode(texto);
            }
            catch (Exception ex)
            {
                throw;
            }
            return rpta;
        }
 private static BeganFollowing ParseEvent(SyndicationContent content)
 {
     // reference to servicestack.text
     var jsonString = ParseFeedContent(content);
     var bf = JsonSerializer.DeserializeFromString<BeganFollowing>(jsonString);
     return bf;
 }
Beispiel #3
0
 /// <summary>
 /// Get the text from a TextSyndicationContent.
 /// </summary>
 /// <param name="content"></param>
 /// <returns></returns>
 public string GetTextSyndicationContent(SyndicationContent content)
 {
     TextSyndicationContent txt = content as TextSyndicationContent;
     if (txt != null)
         return txt.Text;
     else
         return "";
 }
        private static string ParseFeedContent(SyndicationContent syndicationContent)
        {
            using (var sw = new StringWriter())
            using (var xw = XmlWriter.Create(sw))
            {
                syndicationContent.WriteTo(xw, "BF", "BF");
                xw.Flush();

                return XDocument.Parse(sw.ToString()).Root.Value;
            }
        }
 private static string GetContent(SyndicationContent syndicationContent)
 {
     var sw = new StringWriter();
     sw.Write(" ");
     XmlWriter writer = new XmlTextWriter(sw);
     syndicationContent.WriteTo(writer, "whatever", "");
     string text = sw.ToString();
     text = HttpUtility.HtmlDecode(text);
     StripHtml(ref text);
     return text;
 }
 internal void CopyAttributeExtensions(SyndicationContent source)
 {
     if (source == null)
     {
         throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
     }
     if (source.attributeExtensions != null)
     {
         foreach (XmlQualifiedName name in source.attributeExtensions.Keys)
         {
             this.AttributeExtensions.Add(name, source.attributeExtensions[name]);
         }
     }
 }
Beispiel #7
0
 public SyndicationItem(string title, SyndicationContent content, Uri itemAlternateLink, string id, DateTimeOffset lastUpdatedTime)
 {
     if (title != null)
     {
         this.Title = new TextSyndicationContent(title);
     }
     _content = content;
     if (itemAlternateLink != null)
     {
         this.Links.Add(SyndicationLink.CreateAlternateLink(itemAlternateLink));
     }
     _id = id;
     _lastUpdatedTime = lastUpdatedTime;
 }
Beispiel #8
0
        internal void CopyAttributeExtensions(SyndicationContent source)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            if (source._attributeExtensions != null)
            {
                foreach (XmlQualifiedName key in source._attributeExtensions.Keys)
                {
                    this.AttributeExtensions.Add(key, source._attributeExtensions[key]);
                }
            }
        }
Beispiel #9
0
		internal void WriteXml(XmlWriter writer, SyndicationContent content,
													 string outerElementName, bool writeEmptyNodes)
		{
			if (content != null)
				{
					content.WriteTo(writer, outerElementName, FeedNamespace);
					return;
				}

			if (!writeEmptyNodes) return;
			 
			// write out empty node if necessary
			TextSyndicationContent emptyNode = new TextSyndicationContent("");
			emptyNode.WriteTo(writer, outerElementName, FeedNamespace);
		}
Beispiel #10
0
 public SyndicationItem(string title, SyndicationContent content, Uri itemAlternateLink, string id, DateTimeOffset lastUpdatedTime)
 {
     this.extensions = new ExtensibleSyndicationObject();
     if (title != null)
     {
         this.Title = new TextSyndicationContent(title);
     }
     this.content = content;
     if (itemAlternateLink != null)
     {
         this.Links.Add(SyndicationLink.CreateAlternateLink(itemAlternateLink));
     }
     this.id = id;
     this.lastUpdatedTime = lastUpdatedTime;
 }
 protected SyndicationItem(SyndicationItem source)
 {
     extensions        = source.extensions.Clone();
     categories        = Copy <SyndicationCategory> (source.categories);
     authors           = Copy <SyndicationPerson> (source.authors);
     contributors      = Copy <SyndicationPerson> (source.contributors);
     links             = Copy <SyndicationLink> (source.links);
     base_uri          = source.base_uri;    // copy by reference !!
     copyright         = source.copyright == null ? null : source.copyright.Clone() as TextSyndicationContent;
     summary           = source.summary == null ? null : source.summary.Clone() as TextSyndicationContent;
     title             = source.title == null ? null : source.title.Clone() as TextSyndicationContent;
     content           = source.content == null ? null : source.content.Clone();
     id                = source.id;
     last_updated_time = source.last_updated_time;
     published_date    = source.published_date;
     source_feed       = source.source_feed == null ? null : source.source_feed.Clone(false);
 }
        internal void WriteXml(XmlWriter writer, SyndicationContent content,
                               string outerElementName, bool writeEmptyNodes)
        {
            if (content != null)
            {
                content.WriteTo(writer, outerElementName, FeedNamespace);
                return;
            }

            if (!writeEmptyNodes)
            {
                return;
            }

            // write out empty node if necessary
            TextSyndicationContent emptyNode = new TextSyndicationContent("");

            emptyNode.WriteTo(writer, outerElementName, FeedNamespace);
        }
 public JsonSyndicationContent(SyndicationContent content)
 {
     if (content != null)
     {
         this.Type = content.Type;
         if (content is TextSyndicationContent)
         {
             this.Content = (content as TextSyndicationContent).Text;
         }
         else if (content is UrlSyndicationContent)
         {
             this.Content = (content as UrlSyndicationContent).Url.ToString();
         }
         else if (content is XmlSyndicationContent)
         {
             this.Content = ExtensionToString((content as XmlSyndicationContent).Extension);
         }
         else
         {
             this.Content = null;
         }
     }
 }
Beispiel #14
0
 public SyndicationItem(string title, SyndicationContent content, Uri itemAlternateLink, string id, DateTimeOffset lastUpdatedTime)
 {
 }
 protected internal virtual bool TryParseContent(XmlReader reader, string contentType, string version, out SyndicationContent content)
 {
     content = null;
     return(false);
 }
 internal static protected bool TryParseContent(XmlReader reader, SyndicationItem item, string contentType, string version, out SyndicationContent content)
 {
     return(item.TryParseContent(reader, contentType, version, out content));
 }
		protected internal static bool TryParseContent (XmlReader reader, SyndicationItem item, string contentType, string version, out SyndicationContent content)
		{
			if (item == null)
				throw new ArgumentNullException ("item");
			return item.TryParseContent (reader, contentType, version, out content);
		}
 protected SyndicationContent(SyndicationContent source)
 {
     CopyAttributeExtensions(source);
 }
 internal void WriteXml(XmlWriter writer, SyndicationContent content,
                        string outerElementName)
 {
     WriteXml(writer, content, outerElementName, false);
 }
 internal void WriteContentTo(XmlWriter writer, string elementName, SyndicationContent content)
 {
     if (content != null)
     {
         content.WriteTo(writer, elementName, Atom10Constants.Atom10Namespace);
     }
 }
Beispiel #21
0
		internal void WriteXml(XmlWriter writer, SyndicationContent content,
													 string outerElementName)
		{
			WriteXml(writer, content, outerElementName, false);
		}
 internal void WriteContentTo(XmlWriter writer, string elementName, SyndicationContent content)
 {
     if (content != null)
     {
         content.WriteTo(writer, elementName, "http://www.w3.org/2005/Atom");
     }
 }
Beispiel #23
0
 /// <summary>
 ///  Initializes a new instance of the ItunesItem class.
 /// </summary>
 /// <param name="title">The item title.</param>
 /// <param name="content">
 /// A System.ServiceModel.Syndication.SyndicationContent instance containing the content of the syndication item.
 /// </param>
 /// <param name="itemAlternateLink">The item URL.</param>
 /// <param name="id">The ID of the syndication item.</param>
 /// <param name="lastUpdatedTime">The System.DateTimeOffset that contains the last time the syndication item  was last updated.</param>
 public ItunesItem(string title, SyndicationContent content, Uri itemAlternateLink, string id, DateTimeOffset lastUpdatedTime)
     : base(title, content, itemAlternateLink, id, lastUpdatedTime)
 {
 }
 protected internal static bool TryParseContent(XmlReader reader, SyndicationItem item, string contentType, string version, out SyndicationContent content)
 {
     if (item == null)
     {
         throw new ArgumentNullException("item");
     }
     return(item.TryParseContent(reader, contentType, version, out content));
 }
        private static string SerializeItem(SyndicationContent content)
        {
            var output = new StringBuilder();

            using (NoNamespaceXmlWriter writer = new NoNamespaceXmlWriter(new StringWriter(output)))
            {
                content.WriteTo(writer, "content", "");
            }

            return output.ToString();
        }
 internal void CopyAttributeExtensions(SyndicationContent source)
 {
     if (source == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("source");
     }
     if (source.attributeExtensions != null)
     {
         foreach (XmlQualifiedName key in source.attributeExtensions.Keys)
         {
             this.AttributeExtensions.Add(key, source.attributeExtensions[key]);
         }
     }
 }
 /// <summary>
 /// Create an object from SEC stream filing data.
 /// </summary>
 /// <param name="content"></param>
 /// <returns></returns>
 public static EdgarFiling Deserialize(SyndicationContent content)
 {
     return Deserialize(SerializeItem(content));
 }
    protected internal static bool TryParseContent(System.Xml.XmlReader reader, SyndicationItem item, string contentType, string version, out SyndicationContent content)
    {
      Contract.Requires(item != null);

      content = default(SyndicationContent);

      return default(bool);
    }
 protected static bool TryParseContent(XmlReader reader, SyndicationItem item, string contentType, string version, out SyndicationContent content)
 {
     return SyndicationFeedFormatter.TryParseContent(reader, item, contentType, version, out content);
 }
 protected SyndicationContent(SyndicationContent source)
 {
     CopyAttributeExtensions(source);
 }
        protected static bool TryParseContent(System.Xml.XmlReader reader, SyndicationItem item, string contentType, string version, out SyndicationContent content)
        {
            Contract.Requires(item != null);

            content = default(SyndicationContent);

            return(default(bool));
        }
Beispiel #32
0
 protected static bool TryParseContent(XmlReader reader, SyndicationItem item, string contentType, string version, out SyndicationContent content)
 {
     return(SyndicationFeedFormatter.TryParseContent(reader, item, contentType, version, out content));
 }
 protected SyndicationContent(SyndicationContent source)
 {
     if (source == null)
         throw new ArgumentNullException ("source");
     extensions = source.extensions.Clone ();
 }
 public SyndicationItem(string title, string content, Uri itemAlternateLink, string id,
                        DateTimeOffset lastUpdatedTime)
     : this(title, content != null ? SyndicationContent.CreatePlaintextContent(content) : null, itemAlternateLink, id, lastUpdatedTime)
 {
 }
Beispiel #35
0
        protected internal virtual new bool TryParseContent(System.Xml.XmlReader reader, string contentType, string version, out SyndicationContent content)
        {
            content = default(SyndicationContent);

            return(default(bool));
        }