我有一个具有多个<Page Pageid="1">
节点的 XML。所有这些节点<Para Paraid="1">
下都有节点。我想做单次出现节点,以便属于同一节点的<Page>
所有节点都显示为特定页面的子节点。例如<Para>
<Page>
输入:
<Page PageID="**1**">
<Para ParaID="1">
<some nodes as child of para>
</Para>
</Page>
<Page PageID="**2**">
<Para ParaID="**1**">
<some nodes as child of para>
</Para>
</Page>
<Page PageID="**1**"> <!Page 1 encountered again>
<Para ParaID="**1**">
<some nodes as child of para>
</Para>
</Page>
<Page PageID="**3**">
<Para ParaID="**1**">
<some nodes as child of para>
</Para>
</Page>
预期输出:
<Page PageID="**1**">
<Para ParaID="**1**">
<some nodes as child of para>
</Para>
<Para ParaID="**2**"> <!all <Para> of Page 1 are under single <Page> node>
<some nodes as child of para>
</Para>
</Page>
<Page PageID="**2**">
<Para ParaID="**1**">
<some nodes as child of para>
</Para>
</Page>
<Page PageID="**3**">
<Para ParaID="**1**">
<some nodes as child of para>
</Para>
</Page>