오른쪽 structyre에서 rss 문서에 노드를 추가하는 방법을 알아 냈습니다. 이제 pubDate 순서로 정렬 한 다음 화면에 출력해야합니다. 예제를 온라인으로 살펴보면 XDocument와 Linq는 많이 있지만 XmlDocument는 없다는 것을 알았습니다. 내가 갖고있는 코드를 스크랩해서 여기에있는 조언으로 XDocument에서 어떻게 할 것인지, 아니면 XMLDocument를 계속 사용하여 정렬 할 방법을 찾아 내는지에 대한 내 머리를 긁어 라.XMLdocument 정렬
XMLDocument를 사용하면 코드가 정확히 원하는대로 작동하므로 피드를 화면에 뱉어 내면 pubDate 순서로 정렬해야합니다. 그래서 나는 시간을두고이 사실을 고수 할 것입니다. 이 기사 http://support.microsoft.com/kb/555060과 xslt 누군가 Stack Overflow에 게시되었음을 발견했지만 코드에서 "XmlHelperFunctions"를 호출하는 방법을 모른다. XSLT는 내가 가진 가장 쉬운 옵션인가, 아니면 거기에 더 쉬운 것이 있습니까? 당신은 Linq to XML를 사용하여 매우 빠르고 손쉽게 수행 할 수 있습니다
<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0">
<channel>
<title>My RSS Feed</title>
<link>http://www.mylink.aspx</link>
<description>
</description>
<item>
<title>Top marks</title>
<link>http://www.mymarks.aspx</link>
<description>
<p>description field here</p>
</description>
<author>Viv</author>
<pubDate>Thu, 16 Aug 2012 12:10:54 GMT</pubDate>
</item>
<item>
<title>Costa Coffee</title>
<link>http://www.Costa.aspx</link>
<description>
<p>Costa Coffee have special offers.</p>
</description>
<author>Mike</author>
<pubDate>Thu, 23 Aug 2012 15:55:53 GMT</pubDate>
</item>
<item>
<title>Celebrate success</title>
<link>http://www.Celebrate.aspx</link>
<description>
<p>Lets all celebrate </p>
</description>
<author>Viv</author>
<pubDate>Thu, 22 Aug 2012 09:10:21 GMT</pubDate>
</item>
</channel>
</rss>
이것 좀 봐 http://stackoverflow.com/questions/344737/sorting-xml-nodes-based-on-datetime-attribute-c-xpath – saj