CSV to XML transforms using MFL
748184Sep 24 2012 — edited Sep 25 2012Hi,
I'm using Service bus version 10gR3. I am trying to do the following:
Convert a csv file with 11 fields into a piece of XML that I can then process in a different service.
The csv file is on a web server for the time being, so I have setup a business service with a type of: Messaging Service i then select my mfl transform:
<?xml version='1.0' encoding='windows-1252'?>
<!DOCTYPE MessageFormat SYSTEM 'mfl.dtd'>
<!-- Enter description of the message format here. -->
<MessageFormat name='RSPCAUser' version='2.01'>
<FieldFormat name='CostCentreCode' type='String' delimRef='' delim=',' delimOptional='n' codepage='windows-1252'/>
<FieldFormat name='FullName' type='String' delimRef='' delim=',' delimOptional='n' codepage='windows-1252'/>
<FieldFormat name='Salutation' type='String' delimRef='' delim=',' delimOptional='n' codepage='windows-1252'/>
<FieldFormat name='FirstName' type='String' delimRef='' delim=',' delimOptional='n' codepage='windows-1252'/>
<FieldFormat name='Surname' type='String' delimRef='' delim=',' delimOptional='n' codepage='windows-1252'/>
<FieldFormat name='Password' type='String' delimRef='' delim=',' delimOptional='n' codepage='windows-1252'/>
<FieldFormat name='LineManager' type='String' delimRef='' delim=',' delimOptional='n' codepage='windows-1252'/>
<FieldFormat name='Department' type='String' delimRef='' delim=',' delimOptional='n' codepage='windows-1252'/>
<FieldFormat name='HRLocation' type='String' delimRef='' delim=',' delimOptional='n' codepage='windows-1252'/>
<FieldFormat name='JobTitle' type='String' delimRef='' delim=',' delimOptional='n' codepage='windows-1252'/>
<FieldFormat name='WorkForceID' type='String' delimRef='' delim='\n' delimOptional='n' codepage='windows-1252'/>
</MessageFormat>
This is created in Format builder. I then point the buisness service at the csv file on the web server.
When i run this i would expect to see xml returned< but instead see something like this:
00000000: 43 6F 73 74 43 65 6E 74 72 65 43 6F 64 65 2C 46 CostCentreCode,F
00000010: 75 6C 6C 4E 61 6D 65 2C 53 61 6C 75 74 61 74 69 ullName,Salutati
00000020: 6F 6E 2C 46 69 72 73 74 4E 61 6D 65 2C 53 75 72 on,FirstName,Sur
00000030: 6E 61 6D 65 2C 50 61 73 73 77 6F 72 64 2C 4C 69 name,Password,Li
00000040: 6E 65 4D 61 6E 61 67 65 72 2C 44 65 70 61 72 74 neManager,Depart
00000050: 6D 65 6E 74 2C 48 52 4C 6F 63 61 74 69 6F 6E 2C ment,HRLocation,
00000060: 4A 6F 62 54 69 74 6C 65 2C 57 6F 72 6B 46 6F 72 JobTitle,WorkFor
00000070: 63 65 49 44 0A 0A 0A .. .. .. .. .. .. .. .. .. ceID............
Which implies that it thinks it's binary data!
If i test the MFL in service bus it looks ok.
Has anyone else had an experience like this? or can offer some experience in this area?
One other thing, that's not an issue yet, but will be is how do I show end of file in the mfl, my last delimiter for the csv row is a '\n' but this seems to cause A marshalling issue on the last line of the file< so have to fake a new line. The real file i use is generated and won't have an extra line!