FlatFile to XML and XML to FlatFile

Hi All,
I have 2 doubts actually:

1.I have a requirement like my service1 should receives a FaltFile and I want to convert it to a XML String.

  1. In another service I want to convert XML string to FlatFile again.

Can you please clearly tell me(step-by-step procedure ) to do this.

Thanks a lot,

Hi Datta,

For requirement 1, you can write a flatfile schema to convert the flat file into wM document and then convert the doc to a xmlstring.

For #2, you can convert the xmlstring to a wM Doc and them write a conversion service to assemble the flatfile.

Not sure, if there is any other better way to achieve #2.

Just my 2 cents.

Hi anithakuganesan,

For req#1, Do I need to make the DTD/schema similar to FlatFile str?

and For #2, can you elaborate with procedure
Any help is highly appreciated.


Hi Datta,

For the req1, the schema depends on the type of the flatfile (delimited, fixed length etc…). There are samples in WmFlatfileSamples packages…for all the types of schema…you can may be take a look there and try to construct one which suits your req.

For req2, you can use the pub.xml:xmlStringToXmlNode and then pub.xml:xmlNodeToDocument to get a wM Doc…once you get that …you can write a map service to map the doc values to assemble your flatfile.

Again, I am not sure if there is any other optimum way to achieve this.

You can give a try.


Please try to help me ASAP

i’m having a flat file with eid and ename as records.
Now i have to read the flatfile and store the data into an sql database and the i have to read the data from the database and then i have to convert it into xml format.
i’m able to do the xml part but the problem is how to store the data into database and while retrieval i’m getting the eid in form of integer datatype because of this i’m unable to map it to the output xml doc.

With Regards,

when u are retriving the data from the database using select adapter service ,u need to specify the output datatype as string .Then u can map the result to your document and convert it to xml.