Skip to Content
avatar image
Former Member

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

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 "<" ?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • May 16 at 12:25 PM

    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

    Add comment
    10|10000 characters needed characters exceeded