Clarity

  • 1.  Gel parse replaces < > in variable with html code

    Posted Sep 01, 2016 12:03 PM

    I am creating a XML write file (cmn_users_write) in my process and am using a variable to store a part the XML content that should come in the write XML file.

    But when I place the variable inside gel parse to complete my write xml, it replaces the < and > sign by their HTML codes i.e- &lt; and &gt; and making the XOG fail.

    <gel:parse var="v_xml_root">
    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_user.xsd">
    <Header action="write" externalSource="NIKU" objectType="user" version="14.2.0.237"/>
    <Users>
    <User externalId="${v_xog_externalId}" userLanguage="${v_xog_userLanguage}" userName="${v_xog_userName}" userStatus="${v_xog_userStatus}" userType="${v_xog_userType}" >
    <PersonalInformation emailAddress="${v_xog_emailAddress}" firstName="${v_xog_firstName}" lastName="${v_xog_lastName}"/>
    <Resource resourceId="${v_xog_resourceId}"/>
    <InstanceRights>
    ${r3}
    </InstanceRights>
    <InstanceOBSRights/>
    </User>
    </Users>
    </NikuDataBus>
    </gel:parse>

     

     

     

    where variable r3 value is=

    <Right id="ProjectEditManagement">
    <InstanceObject id="tes_req" name="test_req" type= "SRM_PROJECTS"/>
    </Right>

     

     

     

    But if I print the write xml that is generated,I see below-

     


    <?xml version="1.0" encoding="UTF-8"?>
    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_user.xsd">
    <Header action="write" externalSource="NIKU" objectType="user" version="14.2.0.237"/>
    <Users>
    <User externalId="" userLanguage="English" userName="testpm2@test.com" userStatus="ACTIVE" userType="INTERNAL">
    <PersonalInformation emailAddress="testpm2@test.com" firstName="testpm2" lastName="testpm2"/>
    <Resource resourceId="testpm2"/>
    <InstanceRights> &lt;Right id="ProjectEditManagement"&gt;&lt;InstanceObject id="tes_req" name="test_req" type= "SRM_PROJECTS"/&gt;&lt;/Right&gt;</InstanceRights>
    <InstanceOBSRights/>
    </User>
    </Users>
    </NikuDataBus>

     

     

     

     

    If I replace ${r3} by its value in the write file, the xog works.


    Any idea how to let gel consider < and > symbols as they are in parse?

     

    Thanks!

    Ashmi



  • 2.  Re: Gel parse replaces < > in variable with html code
    Best Answer

    Posted Sep 01, 2016 12:24 PM

    Instead of the line which just dumps your variable;

    ${r3}

     

    perhaps try;

    <gel:include select="$r3"/>

     

    I think that that would rely on your r3 variable being an XML type (populated in its own 'gel:parse') though, not just a string variable



  • 3.  Re: Gel parse replaces < > in variable with html code

    Posted Sep 02, 2016 03:01 AM

    Thanks David! making my variable XML type did the trick! I used the include for it

     

    Thanks



  • 4.  Re: Gel parse replaces < > in variable with html code

    Broadcom Employee
    Posted Sep 01, 2016 03:26 PM

    Hi Ashmi,

     

    I believe that's a bug and that only happens if you put comments in your gel script, please remove the comment and see. If it doesn;t replaces then you are hitting the bug I am suspecting.

     

    Regards

    Suman Pramanik