When putting raw XML in a LANSA field, XML syntax is lost when outputting XML

Date:26 July, 2007
Product/Release:LANSA Integrator V11.3
Abstract:The XSL parser is converting the data from < and > to &lt and &gt
Submitted By:LANSA Technical Support

Description:

Putting raw XML in a field which needs to go into the XSL. However, when it outputs the data into the final XML, the result is undesired.

Note how the < and > characters are changed to &lt and &gt respectively.

<?xml version="1.0" encoding="UTF-8"?> 
<Department> 
<Code>ADM</Code> 
<Description>ADMINISTRATION</Description> 
<Employees>&lt;Employee&gt;&lt;Number&gt;A1001&lt;/Number&gt;&lt;Name&gt;BEN
JONES&lt;/Name&gt;&lt;/Employee&gt;</Employees>
</Department>

The output field had <Employee><Number>A1001</Number><Name>BEN JONES</Name></Employee>

The XSL parser is converting the data from < and > to &lt and &gt.

Solution:

Depending on how you are generating the XML, the two solutions are:

  1. If you are using style-sheets:

    When using XSL, add the disable-output-escaping attribute to the xsl:value-of directive
    LANSA function field

    CHANGE FIELD(#CITY) TO('<greatcity>Sydney</greatcity>')

    XSL

    <City><xsl:value-of disable-output-escaping="yes" select="/rdml:function/rdml:fields/rdml:field[@name='CITY']/@value"/></City>

    XML Output

    <City><GREATCITY>SYDNEY</GREATCITY></City>
     
  2. If you are using XMLBindwizard, then you will need to select 'Disable output escaping':

    Refer to Figure 1. below.

    Figure 1. Field Atributes