如何将 XML 拆分为 2 个单独的文档,如下所示?
输入:
<stocks>
<stock>
<stockid>78</stockid>
<desc>Apple</desc>
<details>
<element1>XYZ</element1>
<element2>ABC</element2>
</details>
</stock>
<stock>
<stockid>78</stockid>
<desc>Apple</desc>
<details>
<element1>qwe</element1>
<element2>asd</element2>
</details>
</stock>
<stock>
<stockid>65</stockid>
<desc>Tesla</desc>
<details>
<element1>GHJ</element1>
<element2>JKL</element2>
</details>
</stock>
输出:
文档 1:
<stocks>
<stock>
<stockid>78</stockid>
<desc>Apple</desc>
<details>
<element1>XYZ</element1>
<element2>ABC</element2>
</details>
</stock>
<stock>
<stockid>78</stockid>
<desc>Apple</desc>
<details>
<element1>qwe</element1>
<element2>asd</element2>
</details>
</stock>
文件 2:
<stock>
<stockid>65</stockid>
<desc>Tesla</desc>
<details>
<element1>GHJ</element1>
<element2>JKL</element2>
</details>
</stock>
我已经尝试使用业务规则形状和数据流程形状但失败了。任何人请协助。我所做的是,在数据处理形状中,我尝试根据 stockid 对其进行拆分,但结果不如预期。而且我不知道 groovy 或 javascript,所以我没有尝试使用脚本。