Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
777 views
in Technique[技术] by (71.8m points)

xpath - Iterate XML in talend for missing child nodes

I am working to read the below mentioned XML input in talend open studio using tExtractXMLField.

<Outer>
<Account ID=1>
<Nominee>X</Nominee>
<Nominee>Y</Nominee>
</Account>
<Account ID=2>
<Nominee>Z</Nominee>
</Account>
<Account ID=3>
</Account>
</Outer>

I need to iterate on Nominees and capture the Account 3 even though there is no nominee tag in it. The output should be like one single table at grain of nominee but capturing the account even if there is no nominee.

Account ID | Nominee
1          |  X
1          |  Y
2          |  Z
3          | NULL

I am able to iterate the first 2 accounts successfully but, it misses the third one completely, as there is no nominee. As it is a real time scenario I can not break it into 2 jobs, so need to sort it in one subjob only.

Thanks a lot in advance


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use the following components, tFileInputXML

Use the Account tag, as root.

I leave you a link to the documentation, look at the scenarios, they indicate how to configure the element.

Regards.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...