cancel
Showing results for 
Search instead for 
Did you mean: 

Fastest way to add Root Element to large XML in I-Flow?

cp11
Explorer
0 Kudos

Hello SAP Experts,

I am currently facing the problem that some I-Flows take too long to run through.

The reason is the content modifier which is used after the filter to append the root element to the XML.

Because the filtered document is very large, the content modifier takes a long time to append the root element to the XML.

Is there a more efficient way to append the root element to very large XML documents which would speed up the I-Flow?

Here is an example of how an XML looks like after the filter:

<RawData>
	<UUID>27f0dfb6-03ff-4a9f-a53b-7259cb56b9ca</UUID>
	<Timestamp>2023-10-11 11:00:04.538</Timestamp>
	<UnitOfMeasure>kWh</UnitOfMeasure>
	<Value>132888.8</Value>
</RawData>
<RawData>
	<UUID>27f0dfb6-03ff-4a9f-a53b-7259cb56b9ca</UUID>
	<Timestamp>2023-10-11 11:00:41.543</Timestamp>
	<UnitOfMeasure>kWh</UnitOfMeasure>
	<Value>132888.9</Value>
</RawData>
<RawData>
	<UUID>27f0dfb6-03ff-4a9f-a53b-7259cb56b9ca</UUID>
	...
	...
	...

Best Regards

Chris

Accepted Solutions (1)

Accepted Solutions (1)

MortenWittrock
Active Contributor

Hi Chris

Interesting question! You are touching on the topic of streaming. This is covered in a couple of places in the iflow design guidelines. This page provides an overview of streaming support.

The Filter step does not support streaming. You might alternatively consider doing the filtering in an XSLT stylesheet. XSLT does support streaming, meaning that the input is processed without the whole payload being loaded into memory.

This would also eliminate the need for the slow Content Modifier, since the root element would not be removed.

XSLT streaming is not super straightforward, though. In my answer to this question I discuss some of the restrictions. That question is also about filtering, by the way, so you might find some inspiration there.

If you decide to try this approach, I'd be very interested in hearing how it works out.

Regards,

Morten

cp11
Explorer
0 Kudos

Hello Morten,

thanks for your comment, XSLT was indeed the way I went to work around this problem.

also the hint with the streaming was absolutely right and important for me in this case.

Thanks a lot for your help.

Regards

Chris

MortenWittrock
Active Contributor
0 Kudos

Hi cp1

Very happy to hear that. Thank you for the update!

Regards,

Morten

Answers (1)

Answers (1)

VijayKonam
Active Contributor
0 Kudos

Did you try the same thing in groovy or jscript and checked the difference?