cancel
Showing results for 
Search instead for 
Did you mean: 

Creating plain text data from XML

Former Member
0 Kudos

Hello,

I've created the simple scenario:

1. SOAP Adapter gets the XML message:

<InboundData>123</InboundData>

2. It maps the data usng MessageMapping to the OutboundType that has the only field of OutboundData

3. File Adapter puts the generated data to the FileSystem.

Now I need to store not the XML file as a target, but plain Txt file with the only data - 123. I was trying multiple approaches, but it looks like just the fact that I'm defining OutboundData type forces my data to be XML.

What is the simplest way to store only particular field from XML to the plain text? It looks like I'm missing some concept, so appreciate the link to the tutorial regarding specifically mapping to the text files.

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

roger_gomez
Active Participant
0 Kudos

Hi Maxim,

This blog will help you to solve it easy:

[https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/13292] [original link is broken] [original link is broken] [original link is broken];

Regards,

Roger

Answers (4)

Answers (4)

Former Member
0 Kudos

From what I see StrictXml2PlainBean only supports structures like:

<Root>

<Record>

<Data>This is a data</Data>

</Record>

</Root>

But how can I define my own mapping rules, to handle arbitrary inbound or outbound data to have the plain text (not CSV-like) or even binary blob as a target data format?

roger_gomez
Active Participant
0 Kudos

Hi Maxim,

Please, read the next blog about Conversion Agent:

[https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/3332] [original link is broken] [original link is broken] [original link is broken];

Maybe it covers your requirement.

Regards,

Roger

Former Member
0 Kudos

Thanks for assistance, it makes sense. However, all samples work with the XML tags without namespaces.

What if on the outbound end I have XML like

<ns:OutboundData xmlns:ns="http://namespace">Data</ns:OutboundData>

How namespaces should be treated with StrictXml2PlainBean?

Thanks.

Former Member
0 Kudos

It will convert the Content within the tags to plantext

Namespace shouldn't matter (They don't harm you)...

-SM

Former Member
0 Kudos

As mentioned above File Content Conversion should work:

/people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion

if you don't have any separator you can define the name of the field and the lenght using parameters:

InboundData.fieldNames : field1

InboundData.fieldFixedLengths : 10

InboundData.endSeparator : 'nl'

Shabarish_Nair
Active Contributor
0 Kudos

one option is to use File content conversion to create text files from the XML - http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm