cancel
Showing results for 
Search instead for 
Did you mean: 

File Adapter

Former Member
0 Kudos

Hi All ,

I am using file adapter to write a xml file.

By default the file adapter adds

<?xml version="1.0" encoding="utf-8" ?>

<ns1:MT_TEXT xmlns:ns1="http://NAMESPACE">

<NAME>Rahul</NAME>

</ns1:MT_TEXT>

But i want the XML File Like this way..

<MT_TEXT>

<NAME>Rahul</NAME>

</MT_TEXT>

Is this possible without using File Content Conversion and then using java code to stimulate the creation of XML file.

Regards,

Sumit

Accepted Solutions (0)

Answers (4)

Answers (4)

bhavesh_kantilal
Active Contributor
0 Kudos

Rahul,

This is explained in this blog as well,

/people/sameer.shadab/blog/2005/12/05/how-to-remove-namespaces-in-mapping--xi

Regards,

Bhavesh

Former Member
0 Kudos

Hi Bhavesh,

Thanks for that wonderful link..

One more problem is there how do i delete the first line?

<?xml version----->

Thanks

Rahul

bhavesh_kantilal
Active Contributor
0 Kudos

Rahul,

Why do you want to do that?An XML file should always have the first line as , <b><?xml version-----></b> .

If you are seriouly looking at a way to remove the <?xml version-----> but continue to have a XML payload in the file, then there is no standard way. Write a Module and remove that line!!!

Regards,

Bhavesh

Former Member
0 Kudos

Rahul,

A file is called a xml file only if has the first line as <b><?xml version-----></b>. Can you let us know your requirement as why you need to delete this line..

Regards,

Jai Shankar

Former Member
0 Kudos

Hi Bhavesh,

I know it is a standard for well formed XML documents.

The thirdparty whom i am giving the text file doesnt want that line.

Can you please temme in brief how to write a module and remove that line..

or you think file content conversion using java code would be better.

Thanks & Regards,

Rahul

Former Member
0 Kudos

Hi,

You can do this using Java Mapping. In Java Mapping you can create your own contents that is written to the output stream. You have many blogs regarding Java Mapping.

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii

You can even avoid content conversion and parse the csv file in Java Mapping itself. Take a look at the following blogs:

/people/rahul.nawale2/blog/2006/07/18/java-mapping-an-alternate-way-of-reading-a-csv-file

/people/venkataramanan.parameswaran/blog/2006/12/12/java-mapping-to-handle-flat-files-in-sap-xi

Regards,

P.Venkat

Message was edited by:

Venkataramanan Parameswaran

bhavesh_kantilal
Active Contributor
0 Kudos

Rahul,

Modules --> This article should help.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3bdc14e1-0901-0010-b5a9-a01e29d7...

Another option istead of using Graphical Mapping, use Java Mapping and in the output stream do not create the line <xml version.... >

I would prefer going the module way though!

Regards,

Bhavesh

Former Member
0 Kudos

Hi,

Your XI xml file will surely contain all these values.

If you dont want to use file content conversion then you can use java coding.

thanks.

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

This can be done withot java coding and content conversion.

Go to your Target Message type in the IR and there you will find the field NAMESPACE. Delete the namespace and then your XML will be created without Namespace.

But, you will have to reload the target message type in the mapping and redo the mapping and activate the changes for the change to be seen int he target file.

Regards,

Bhavesh

former_member189558
Contributor
0 Kudos

Wrong Answer .. deleted

Message was edited by:

Himadri Chakraborty