large flat files to XML conversions - Need advise

Hi All,

We have the below scenario.

Our requirement is to convert the large flat file to XML and write it to a file on the local system.

We are reading a large FF (50 MB) from the tspace and and is passing this iteratively to the service convertToValues in a repeat step.

This way we are handling the parsing of large FF. but, as our requirement is to convert the doc (output of convertToValues) to XML string, we have to use “documentToXMLString” service to convert it to XML string.

Suppose if we do 10 iterations, we end up in creating 10 XMLs and all 10 XMLs will be appended to a single file on local disk.
here we end up having 10 root tag elements.

but our requirement is we need to form a single xml file with single header, single root tag. (Not sure if making “addheader” of documentToXMLString to ‘false’ helps)

Could you please advise how can we form a single valid xml even tho we iterate multiple times over a large FF data.

Thanks,
Venkat.

I believe there is a section of the FlatFile Schema Developers Guide.pdf which discusses how to handle large FlatFiles.

I think something related to setting the iterate variable to true on convertToValues inside a repeat. Can you post a sample FF?

Cheers,
Akshith

Hi Akshith,

Thanks for the quick reply.
'Problem is not with the parsing of large FF. As you said, setting the ‘iterate’ to true will suffice.

The challenge here is how to form a single XML string from the doc created by the iterations of ‘convertToValues’ step.

Suppose, ‘convertToValues’ iterates for 10 times, we will get 10 documents from this step in the reapeat step. How can we form a single XML string from these 10 docs.

Hope you understand my requirement

Well you can follow the below approach… when you are in loop (processing one node) convert the output doc into xmlString using public service documenttoXmlString, then convert this string to stream and write some java code to append this stream for every execution… and finally when you done with processing with your file … write the stream to o/p xml file…

Heyy…

I am afraid I have not understood ur response completely.
Nyways, here is the approach I feel similar to what you suggested that we followed.

Repeat
convertToValues (Iterate=‘true’)
Map (to designated format)
documenttoXmlString (addHeader = ‘false’)
If repeat=‘null’ append header
StringToBytes
Append to a file on local disc

Please let me know if the approach is ok…

Thanks,
Venkat