I have a bit of a strange problem here and I hope someone can help me.
We have been using Stylus Studio for a number of years for converting various flat file formats into XML, but recently have come up against a new format that I have no idea how to deal with.
Is there any prefix in the row or it's the raw field data?
Is the header only present once in the first 2 lines of the file?
How large are these files in Kilobytes?
Is the double empty line the record separator?
Do you need to run the conversion as batch outside Stylus Studio?
Subject:Line Delimitted File Conversion Author:Richard Egginton Date:11 Jul 2013 03:29 AM Originally Posted: 11 Jul 2013 03:28 AM
Hi Ivan
Many thanks for your reply.
>Is there any prefix in the row or it's the raw field data?
Basically, it's the raw data. The first field is a row Id, so we can say that that would always be an integer value.
>Is the header only present once in the first 2 lines of the file?
Yes, the header is only present once at the top of the file
>How large are these files in Kilobytes?
These are averaging 100-500KB in size
>Is the double empty line the record separator?
We get files of this format from a number of different sources and the double space seems to vary. I guess at best we can say that we know that each record contains 5 fields. The double space is not consistent
>Do you need to run the conversion as batch outside Stylus Studio?
Conventionally, we are using Stylus Studio to define a converter and an XSLT to transpose the resulting XML into the format we need. We have an application that we have writted which uses the API to apply the converter and then the XSLT to files that we receive.
The following solution assumes the following:
- There is only one header (2 lines) at the the beginning of the file.
- The file is not huge.
- All empty lines are filtered out.
- The remaining fields are group by 8 for each record.
- The input document is loaded using the built-in CSV converter
For example converter:CSV:root=root?file:///c:/test/data.txt