Author |
Message
|
jr_martin |
Posted: Tue Apr 28, 2009 7:12 pm Post subject: pipe delimited file to xml |
|
|
 Apprentice
Joined: 24 Aug 2005 Posts: 36 Location: NY
|
Hi,
I am using following options to create an XML file from a delimited flat file. Based on actual output file, it looks like, I need to enforce line feed along with delimiter for record seperation. How do I achieve the expected output?
Message domain = MRM
dataElementSeparation = AllElementsDelimited
delimiter = | (PIPE)
Input File:
A1|B1|C1
D1|E1|F1
G1|H1|I1
Expected output:
<Record>
<field1>A1</field1>
<field2>B1</field2>
<field3>C1</field3>
</Record>
<Record>
<field1>D1</field1>
<field2>E1</field2>
<field3>F1</field3>
</Record>
<Record>
<field1>G1</field1>
<field2>H1</field2>
<field3>I1</field3>
</Record>
Actual Output:
<Record>
<field1>A1</field1>
<field2>B1</field2>
<field3>C1D1</field3>
</Record>
<Record>
<field1>E1</field1>
<field2>F1G1</field2>
</Record>
<Record>
<field1>H1</field1>
<field2>I1</field2>
</Record>
Environment: WMB6103@solaris, Toolkit@Windows |
|
Back to top |
|
 |
kimbert |
Posted: Wed Apr 29, 2009 12:36 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
This is fairly basic stuff. Please take a look in the samples gallery ( there is a CSV sample ), or search this forum for examples. |
|
Back to top |
|
 |
jr_martin |
Posted: Wed Apr 29, 2009 3:45 am Post subject: |
|
|
 Apprentice
Joined: 24 Aug 2005 Posts: 36 Location: NY
|
Actually, I started with CSV sample. In CSV example, <CR><LF> is not enforced for for record separation. Can you tell me which attribute is causing the issue?
Thanks. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Apr 29, 2009 4:35 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Actually, I started with CSV sample |
Really? I didn't know that until now.
Quote: |
In CSV example, <CR><LF> is not enforced for for record separation |
Not sure what you mean. CSV, by definition, consists of lines of text with the fields separated by commas. Are you claiming that the CSV sample does not work? |
|
Back to top |
|
 |
jr_martin |
Posted: Wed Apr 29, 2009 6:52 am Post subject: |
|
|
 Apprentice
Joined: 24 Aug 2005 Posts: 36 Location: NY
|
CSV sample worked ok.I made the following modifications to that sample to process delimited file.
Messaging standard = Userdefined Text
dataElementSeparation = AllElementsDelimited
delimiter = | (PIPE)
Issue is with the field3 of record1 in the actual ouput xml file => <field3>C1D1</field3>
Why field1 of record2 (D1) is being populated in record1 of output file? |
|
Back to top |
|
 |
kimbert |
Posted: Wed Apr 29, 2009 7:07 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
The parser is doing exactly what you have told it to do. It is splitting up the input text using the pipe character.
Quote: |
Why field1 of record2 (D1) is being populated in record1 of output file? |
Because you have not defined the linefeed character(s) as a delimiter. You need *two* complex types for this, not one.
Please look carefully at the CSV message set in the sample, and try to *understand* it. |
|
Back to top |
|
 |
jr_martin |
Posted: Wed Apr 29, 2009 10:50 am Post subject: |
|
|
 Apprentice
Joined: 24 Aug 2005 Posts: 36 Location: NY
|
Thanks, I used two complex types, it worked. |
|
Back to top |
|
 |
|