CampaignRows
我的KeywordPerformanceReportColumns 列中提到了一个具有 10 个属性的类
我有一个加载了以下 xml 的 XDocumet
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://adcenter.microsoft.com/advertiser/reporting/v5/XMLSchema" >
<KeywordPerformanceReportColumns>
<Column name="CampaignName" />
<Column name="AdGroupName" />
<Column name="Keyword" />
<Column name="Devicetype" />
<Column name="Clicks" />
<Column name="Impressions" />
<Column name="Ctr" />
<Column name="AverageCpc" />
<Column name="ConversionRate" />
<Column name="GregorianDate" />
</KeywordPerformanceReportColumns>
<Table>
<Row>
<CampaignName value="sdfdsf October 4, 2011" />
<AdGroupName value="sdfsdf and sdf" />
<Keyword value="sdf sdf" />
<Devicetype value="Computer" />
<Clicks value="0" />
<Impressions value="7" />
<Ctr value="0.0000" />
<AverageCpc value="0.00" />
<ConversionRate value="" />
<GregorianDate value="4/1/2014" />
</Row>
<Row>
<CampaignName value="sdfdsf October 5, 2011" />
<AdGroupName value="sdfsdf and sdf" />
<Keyword value="sdf sdf" />
<Devicetype value="Computer" />
<Clicks value="0" />
<Impressions value="1" />
<Ctr value="0.0000" />
<AverageCpc value="0.00" />
<ConversionRate value="" />
<GregorianDate value="4/1/2014" />
</Row>
<Row>
<CampaignName value="sdfdsf October 6, 2011" />
<AdGroupName value="sdfsdf and sdf" />
<Keyword value="sdf sdf" />
<Devicetype value="Computer" />
<Clicks value="0" />
<Impressions value="7" />
<Ctr value="0.0000" />
<AverageCpc value="0.00" />
<ConversionRate value="" />
<GregorianDate value="4/1/2014" />
</Row>
</Table>
<Copyright>Abcd</Copyright>
</Report>
如何使用行节点中的每一行数据填充 Xlinq 查询中的列表
var person = from p in XDocument.Load(@"E:\526571836.xml").Descendants("Report").Descendants("Table").Descendants("Row")
select new Campaign { CampaignName = p.Element("CampaignName").Attribute("value").Value };
int icnt = person.Count();//having result = 0