在我看到的与我的类似的其他示例中,有一个根节点,然后是一个数组节点,然后是一堆数组项。我的问题是,我的根节点是我的数组节点,所以我看到的示例似乎对我不起作用,而且我无法更改 XML 模式。这是 XML:
<articles>
<article>
<guid>7f6da9df-1a91-4e20-8b66-07ac7548dc47</guid>
<order>1</order>
<type>deal_abstract</type>
<textType></textType>
<id></id>
<title>Abu Dhabi's IPIC Eyes Bond Sale After Cepsa Buy</title>
<summary>Abu Dhabi's IPIC has appointed banks for a potential sterling and euro-denominated bond issue, a document showed on Wednesday, after the firm acquired Spain's Cepsa in a $5 billion deal earlier this month...</summary>
<readmore></readmore>
<fileName></fileName>
<articleDate>02/24/2011 00:00:00 AM</articleDate>
<articleDateType></articleDateType>
</article>
<article>
<guid>1c3e57a0-c471-425a-87dd-051e69ecb7c5</guid>
<order>2</order>
<type>deal_abstract</type>
<textType></textType>
<id></id>
<title>Big Law Abuzz Over New China Security Review</title>
<summary>China’s newly established foreign investment M&A review committee has been the subject of much legal chatter in the Middle Kingdom and beyond. Earlier this month, the State Council unveiled legislative guidance on…</summary>
<readmore></readmore>
<fileName></fileName>
<articleDate>02/23/2011 00:00:00 AM</articleDate>
<articleDateType></articleDateType>
</article>
</articles>
这是我的课:
public class CurrentsResultsList
{
public Article[] Articles;
}
public class Article
{
public string Guid { get; set; }
public int Order { get; set; }
public string Type { get; set; }
public string Title { get; set; }
public string Summary { get; set; }
public DateTime ArticleDate { get; set; }
}
这是来自外部 API 的 XML 响应。