Exemplo n.º 1
0
		public void WriteTo ()
		{
			TextSyndicationContent t = new TextSyndicationContent (null);
			StringWriter sw = new StringWriter ();
			using (XmlWriter w = CreateWriter (sw))
				t.WriteTo (w, "root", String.Empty);
			Assert.AreEqual ("<root type=\"text\"></root>", sw.ToString ());

			t = new TextSyndicationContent ("broken<b>html", TextSyndicationContentKind.Html);
			sw = new StringWriter ();
			using (XmlWriter w = CreateWriter (sw))
				t.WriteTo (w, "root", String.Empty);
			Assert.AreEqual ("<root type=\"html\">broken&lt;b&gt;html</root>", sw.ToString ());
		}
Exemplo n.º 2
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);
		}
Exemplo n.º 3
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);
        }