Talend txmlmap generate Sequence for Child



我是 talend 的新手,正在尝试解析 xml 文档并生成 etl 序列以维护子父关系。这里的情况是我有一个这样的xml:

<RDF>
<footPrint>
<custid>123</custid>
<item>
<itemCd>apple</itemCd>
</item>
<item>
<itemCd>orange</itemCd>
</item>
</footPrint>
<footPrint>
<custid>456</custid>
<item>
<itemCd>grapes</itemCd>
</item>
<item>
<itemCd>kiwi</itemCd>
</item>
</footPrint>
</RDF>

我试图实现的输出是:

id | Custid | item_seq | item
-------------------------------
1  | 123    | 1        | apple
1  | 123    | 2        | orange
2  | 456    | 1        | grapes
2  | 456    | 2        | kiwi 

任何帮助将不胜感激。

使用 tFIleInputXML 并将 Xpath 循环查询设置为 "/RDF/footPrint/item">

向架构添加两列,即cust_id和项目。 这些列将自动引用映射内容。

比cust_id将 Xpath 查询设置为 - "../custid" 将 Xpath 查询设置为"itemCd">

你会得到你的结果。 希望这个帮助...

最新更新