cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert .txt files to xml format .

Former Member
0 Kudos

HI All,

We have a requirement like ,we have to convert the .txt file to xml format and send to Enterprise portal system.the .txt file looks like this...

-


Schedule D - District/Port List (by District Code) [Produced13APR11]

-


District | Port | Name

Code | Code |

-


01 | | PORTLAND, ME

| 0101 | PORTLAND, ME

| 0102 | BANGOR, ME

| 0103 | EASTPORT, ME

| 0104 | JACKMAN, ME

| 0105 | VANCEBORO, ME

| 0106 | HOULTON, ME

| 0107 | FORT FAIRFIELD, ME

| 0108 | VAN BUREN, ME

| 0109 | MADAWASKA, ME

| 0110 | FORT KENT, ME

| 0111 | BATH, ME

| 0112 | BAR HARBOR, ME

| 0115 | CALAIS, ME

| 0118 | LIMESTONE, ME

| 0121 | ROCKLAND, ME

| 0122 | JONESPORT, ME

| 0127 | BRIDGEWATER, ME

| 0131 | PORTSMOUTH, NH

| 0132 | BELFAST, ME

| 0152 | SEARSPORT, ME

| 0181 | LEBANON AIRPORT

| 0182 | MANCHESTER USER FEE AIRPORT, NH

-


Can any one suggest your valuble suggestions to me....

Thanks

SAYEE.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

File to File senario....write file content conversion for sender side as it is text file. receiver side receiver side u can spesify in data tye...it will gives the XML file.

Generally our PI will give output directlt as a XML file if you give file name ends with .xml. for text file only u need to cretae FCC...

Thanks

Edited by: VenkatSivaramakrishna on Jun 15, 2011 4:05 PM

Former Member
0 Kudos
Former Member
0 Kudos

Hi Sayee,

You need to write File Content Coversion in the Sender Communication Channel.

Create a sender channel with parameters:

i) Transport Protocol - File System (NFS) or FTP

ii) Message Protocol - File Content Conversion

If you are using PI 71. and above, you will have a tab called content conversion and there you need to write the conversion logic.

Cheers,

Souvik

Former Member
0 Kudos

HI Souvik,

HI thanks a lot for u r response... I know that to use FCC but i want the sample how to convert the data to .txt to xml i have given

Former Member
0 Kudos

You need to set up at least 3 mandatory parameters:

<node>.fieldSeparator u2013 can be a comma for a CSV file, or any other separator. You can specify the hex code here, e.g. for a tab separated file you could provide u20180×09u2019 (including quotes).

<node> .endSeparator u2013 signifies the end of a record, u2018nlu2019 (including quotes) indicates a new line character.

<node> .fieldNames u2013 list of field names in each record.

Specify the following in the sender cc.

Adapter Type :FILE

Transport Protocol : FILE SYSTEM

Message Protocol : File content conversion

Adapter Engine : Integration Server

Specify the source directory and the file name from where you have to pick the file.

Recordset Structure : Item,*

Recordsets per message : *

Key Field Name : kz

Key Field Type :String

Setting, can be something like this:

Name Value

Item.keyFieldValue I

Item.fieldFixedLengths

Item.fieldNames

District,Port,Name

Item.endSeparator

'nl'

ignoreRecordSet

true

baskar_gopalakrishnan2
Active Contributor
0 Kudos

> know that to use FCC but i want the sample how to convert the data to .txt to xml i have giv

Please refer this

1) [link |http://www.riyaz.net/blog/xipi-file-content-conversion-for-simple-structure/technology/sap/75/]for the sample

2) [link|http://www.riyaz.net/blog/xipi-file-content-conversion-for-complex-structures/technology/sap/79/] for the sample