开发者

Complex sorting of XML subnodes in .Net3.5 onwards

开发者 https://www.devze.com 2022-12-28 16:03 出处:网络
XML structure expressed in Xpath kind of Records/Record/Actions/Action/ActionDate the other node on the same level

XML structure expressed in Xpath kind of

Records/Record/Actions/Action/ActionDate

the other node on the same level

Records/Record/Actions/Action/CTCDate

Is there easy or not easy way to sort it on "order by ActionDate,CTCDate" ( in SQL notation ), but per Actions for each selected Record ( not per XML file ) when we iterate somehow and generate sorted XML. File around 50M

Input

  <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>

Output

  <Record>
    <Name>Zywocinski, Cynthia A.</Name>
    <Classification>Individual</Classification>
    <CTType>Reciprocal</CTType>
    <Addresses>
      <Address>
        <City>Lancaster</City>
        <ZIP>01523</ZIP>
        开发者_StackOverflow<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

精彩评论

暂无评论...
验证码 换一张
取 消