C# と .NET 4 で Atom エントリを作成するにはどうすればよいですか?
この構造でエントリを作成する必要があります。
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:f="XXX:aaa">
<title>title1</title>
<summary>summary1</summary>
</entry>
SyndicationItem クラスでこれを実行しようとしましたが、エントリには必要以上の情報が含まれています。
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());
結果は次のとおりです。
<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>
、および type="*" を使用せずにアトムエントリオブジェクトを作成して、希望どおりに見えるようにするにはどうすればよいですか?
コードを単純化するのを手伝ってもらえますか?
ありがとう!