从.Net3.5开始对XML子节点进行复杂排序

时间:2010-04-28 06:46:38

标签: xml .net-3.5 linq-to-xml

以Xpath类型

表示的XML结构
Records/Record/Actions/Action/ActionDate

同一级别的另一个节点

Records/Record/Actions/Action/CTCDate

是否有简单或不容易的方法对“按ActionDate,CTCDate排序”(在SQL表示法中)排序,但是当我们以某种方式迭代并生成排序的XML时,每个选定的记录(不是每个XML文件)的每个动作。文件大约50M

输入

  <Record>
    <Name>Zywocinski, Cynthia A.</Name>
    <Classification>Individual</Classification>
    <CTType>Reciprocal</CTType>
    <Addresses>
      <Address>
        <City>Lancaster</City>
        <ZIP>01523</ZIP>
        <Province/>
        <State>MA</State>
        <DUNS/>
      </Address>
    </Addresses>
    <References>
      <Reference>Zywocinski-White, Cynthia</Reference>
    </References>
    <Actions>
     <Action>
       <ActionDate>13-Oct-1999</ActionDate>
       <TermDate>Indef.</TermDate>
       <CTCode>Z1</CTCode>
       <AgencyComponent>HHS</AgencyComponent>
       <EPLSCreateDate>29-Jul-1999</EPLSCreateDate>
     </Action>
     <Action>
       <ActionDate>13-Oct-1999</ActionDate>
       <TermDate>Indef.</TermDate>
       <CTCode>A1</CTCode>
       <AgencyComponent>HHS</AgencyComponent>
       <EPLSCreateDate>29-Jul-1999</EPLSCreateDate>
     </Action>
     <Action>
       <ActionDate>20-Jul-1999</ActionDate>
       <TermDate>Indef.</TermDate>
       <CTCode>R</CTCode>
       <AgencyComponent>OPM</AgencyComponent>
       <EPLSCreateDate>29-Oct-1999</EPLSCreateDate>
     </Action>
    </Actions>
    <Description/>
    <AgencyIdentifiers/>
  </Record>

输出

  <Record>
    <Name>Zywocinski, Cynthia A.</Name>
    <Classification>Individual</Classification>
    <CTType>Reciprocal</CTType>
    <Addresses>
      <Address>
        <City>Lancaster</City>
        <ZIP>01523</ZIP>
        <Province/>
        <State>MA</State>
        <DUNS/>
      </Address>
    </Addresses>
    <References>
      <Reference>Zywocinski-White, Cynthia</Reference>
    </References>
    <Actions>
     <Action>
       <ActionDate>20-Jul-1999</ActionDate>
       <TermDate>Indef.</TermDate>
       <CTCode>R</CTCode>
       <AgencyComponent>OPM</AgencyComponent>
       <EPLSCreateDate>29-Oct-1999</EPLSCreateDate>
     </Action>
     <Action>
       <ActionDate>13-Oct-1999</ActionDate>
       <TermDate>Indef.</TermDate>
       <CTCode>A1</CTCode>
       <AgencyComponent>HHS</AgencyComponent>
       <EPLSCreateDate>29-Jul-1999</EPLSCreateDate>
     </Action>
     <Action>
       <ActionDate>13-Oct-1999</ActionDate>
       <TermDate>Indef.</TermDate>
       <CTCode>Z1</CTCode>
       <AgencyComponent>HHS</AgencyComponent>
       <EPLSCreateDate>29-Jul-1999</EPLSCreateDate>
     </Action>
    </Actions>
    <Description/>
    <AgencyIdentifiers/>
  </Record>

0 个答案:

没有答案
相关问题