cancel
Showing results for 
Search instead for 
Did you mean: 

Why the message goes out with "&lt;" and not with what is indicated in the java mapping "<"

former_member338135
Discoverer
0 Kudos
I tried the following java mapping

inputContent=inputContent.replaceAll("\\<\\?xml(.+?)\\?\\>", "").trim().replaceAll(" xmlns=\"http://taf-jsg.info/schemes\"","");

inputContent = inputContent.replaceAll("\\<","\\<").replaceAll("\\>","\\>"); inputContent = inputContent.replaceAll("&","&");

return inputContent;

In the mapping test it works correctly by letting out a single string like

<string><TrainRunningForecastMessage xmlns="http://taf-jsg.info/schemes">

<MessageHeader>

<MessageReference>

<MessageType>4004</MessageType>

<MessageTypeVersion>2.1.3</MessageTypeVersion>

<MessageIdentifier>e50b84e6-a319-4b86-ae44-d4fac65a71ad</MessageIdentifier>

<MessageDateTime>2018-05-15T17:32:54.057+02:00</MessageDateTime>

</MessageReference>

<Sender>3178</Sender>

<Recipient>2183</Recipient>

</MessageHeader>....

when the message leaves the communication channel and arrives at the destination it exits instead in the following format

<string>&lt;TrainRunningForecastMessage&gt;

&lt;MessageHeader&gt;

&lt;MessageReference&gt;

&lt;MessageType&gt;4004&lt;/MessageType&gt;

&lt;MessageTypeVersion&gt;2.1.3&lt;/MessageTypeVersion&gt;

&lt;MessageIdentifier&gt;fcb797d3-aba7-437b-8475-a287bfa886bf&lt;/MessageIdentifier&gt;

&lt;MessageDateTime&gt;2018-05-15T12:07:37.017+02:00&lt;/MessageDateTime&gt;

&lt;/MessageReference&gt;

&lt;Sender&gt;3178&lt;/Sender&gt;

&lt;Recipient&gt;2183&lt;/Recipient&gt;

&lt;/MessageHeader&gt;....

Why trasforma "&lt;" with "<" ?

Accepted Solutions (0)

Answers (1)

Answers (1)

dilipkkp2412
Contributor
0 Kudos

Hi,

I thnik, you should be doing below only to get the desired result:

  • //To replace '<?xml(.+?)?>' with blank
  • inputContent = inputContent.replaceAll("\\<\\?xml(.+?)\\?\\>", "").trim();
  • //To replace ' xmlns="http://taf-jsg.info/schemes"' with blank
  • inputContent = inputContent.replaceAll(" xmlns=\"http://taf-jsg.info/schemes\"","");
  • //transform inputContent to Xml document


Regards,

Dilip