Ask Your Question

Adding XML root element

asked 2018-03-02 01:55:12 -0600

mikygit gravatar image

I'm reading big XML files specifying a delimiter which chunk the content into Records. Those are missing an element root which is necessary at later stage for instance when publisinh into kafka.

Is it possible to convert those records (applying a transformation) and apply a root to each of them? How would you do this?


edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2020-04-24 11:53:21 -0600

jeff gravatar image

If you have only a few root level fields, then the Expression Evaluator is probably the simplest method to achieve this. See this answer for an example of how to accomplish this. In your case, you will also need to add a Field Remover after this to remove the now-copied former root elements.

Note that if your source data is XML, then SDC-9404 may apply. This adds an option to preserve the root level element on the origin side, which would then keep the previously top level elements underneath a new single root level element.

edit flag offensive delete link more

answered 2018-03-02 07:25:43 -0600

mikygit gravatar image

I found a way by using the Renamer component

edit flag offensive delete link more


Can you please post more details?

jeff gravatar imagejeff ( 2018-03-06 10:18:56 -0600 )edit

What do you mean? Concerning my initial problem or the solution I found?

mikygit gravatar imagemikygit ( 2018-03-06 10:36:18 -0600 )edit

The solution you found, please. That way the question and answer can benefit others who might have the same problem.

jeff gravatar imagejeff ( 2020-04-24 11:19:48 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-03-02 01:55:12 -0600

Seen: 190 times

Last updated: Apr 24