.Net3.5 及以上版本中 XML 子节点的复杂排序
的 Xpath 类型表示
Records/Record/Actions/Action/ActionDate
XML 结构以同一级别的其他节点
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>
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>
<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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论