How can I make an Atom entry with C# and .NET 4 ?
I need to make an entry with this structure:
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:f="XXX:aaa">
<title>title1</title>
<summary>summary1</summary>
</entry>
I tried to do this with SyndicationItem class but entry contains more info than I need:
SyndicationItem atom = new SyndicationItem();
atom.Title = new TextSyndicationContent("test1", TextSyndicationContentKind.Plaintext);
atom.Summary = new TextSyndicationContent("summary1");
atom.AttributeExtensions.Add(new XmlQualifiedName("f", "http://www.w3.org/2000/xmlns/"), "XXX:aaa");
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.IndentChars = " ";
settings.NewLineOnAttributes = true;
StringBuilder sb = new StringBuilder();
XmlWriter xml = XmlWriter.Create(sb,settings);
atom.SaveAsAtom10(xml);
xml.Close();
Console.WriteLine(sb.ToString());
And the result is:
<entry xmlns:f="XXX:aaa" xmlns="http://www.w3.org/2005/Atom">
<id>uuid:34381971-9feb-4444-9e6a-3fbc412ac6d2;id=1</id>
<title type="text">title1</title>
<summary type="text">summary1</summary>
<updated>2010-10-29T14:02:48Z</updated>
</entry>
How can I create atom entry object without , and type="*" to make it look exactly I want?
Can you help me to simplify the code?
Thanks!