xml数组对象的数量

时间:2014-04-24 19:13:05

标签: c# xml count deserialization

 <LabelRequest   Test="NO" LabelType="International">
 <MailClass>PriorityMailInternational</MailClass>
 <CustomsInfo>
<ContentsType>Documents</ContentsType>
 <InvoiceNumber>Invoice 678</InvoiceNumber>
<EelPfc>NOEEI 30.37(a)</EelPfc>
<Customs>
  <CustomsItem>
    <Description>Item 1</Description>
    <Value>75</Value>
    <CountryOfOrigin>US</CountryOfOrigin>
  </CustomsItem>
  <CustomsItem>
    <Description>Item 2</Description>
    <Value>25.50</Value>
    <HSTariffNumber>123456</HSTariffNumber>
    <CountryOfOrigin>US</CountryOfOrigin>
  </CustomsItem>
  <CustomsItem>
    <Description>Item 3</Description>
    <Value>27.50</Value>
    <CountryOfOrigin>US</CountryOfOrigin>
  </CustomsItem>
  <CustomsItem>
    <Description>Item 4</Description>
    <Value>33.75</Value>
    <CountryOfOrigin>US</CountryOfOrigin>
  </CustomsItem>
</Customs>
 </CustomsInfo>
  <EelPfc>NOEEI 30.37(a)</EelPfc>
  <CostCenter>95747</CostCenter>
  </LabelRequest>

我有一个像这样的Xml。我必须反序列化这个xml.whats问题是,CustomsInfo中的海关不会生成与上面xml相同的CustomsItem数组,因为它包含4个CustomsItem元素。它可以生成5个元素或6个元素。现在我怎么算数 海关生成了多少个CustomItem元素。

0 个答案:

没有答案