Clarity PPM

Expand all | Collapse all

How to insert <! [CDATA [$ {Var}] into a field of an object via xog?

Jump to Best Answer
  • 1.  How to insert <! [CDATA [$ {Var}] into a field of an object via xog?

    Posted 07-31-2018 12:28 PM

    Hi All,

     

    I need to insert the CDATA element as a string and it should not be recognized as CDATA by xml in gelscript, as this will cause the element not to be written as a string in the field.

    The result when writing to the object would be close to that of the attached image:

     

    <ColumnValue name="blabla"><![CDATA[$ {Var}]]></ColumnValue>

    CDATA recorded within a field

     

    Thanks in advance



  • 2.  Re: How to insert <! [CDATA [$ {Var}] into a field of an object via xog?

    Posted 07-31-2018 11:31 PM

    Hi thiagopimenta,

     

    I think that both < and   in your string are XML reserved character and they will not be acceptable by XOG. 

    You may need to change <  (less than sign)  to &lt; and > (greater than sign)  to &gt;.

     

    There is some other XML reserved character and if you need to use them in XML, you may need to change them.

     

    <    &lt;

    >    &gt;

    &    &amp;

    '      &apos;

    "      &quot;

     

            

    I changed your string as below and it worked in my test.

     

    (Before)

    <![CDATA[$ {Var}]]>

    (After)

    &lt;![CDATA[$ {Var}]]&gt;

     

    I hope  it will resolve your issue.

     

    Regards,

    Shoichi



  • 3.  Re: How to insert <! [CDATA [$ {Var}] into a field of an object via xog?

    Posted 08-07-2018 05:31 PM

    Hi Shoichi,

     

    I've tried this, however in the field the CDATA tag gets written with the & lt; e & gt; by doing this & gt; and & lt; are written that way and not translated to <> being that I would need it to be written with the <! [CDATA [$ {Var}]> tag in the field. But as expected, xml understands that CDATA is a way to escape everything that is included in it and when recording in the field the <! [CDATA []]> tag disappears, leaving only its contents. Anyway, thank you very much for your comment, if you can find a solution I will describe it here.



  • 4.  Re: How to insert <! [CDATA [$ {Var}] into a field of an object via xog?
    Best Answer

    Posted 08-07-2018 10:07 PM

    Hi thiagopimenta,

     

    I used following xog xml.

    It updates "string1" column of instanceCode=1 data with "&lt;![CDATA[$ {Var}]]&gt;"  

     

    --------------

     

    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_customObjectInstance.xsd">
    <Header action="write" externalSource="NIKU" objectType="customObjectInstance" version="15.4.1.115"/>
    <customObjectInstances objectCode="sugsh02_object">
    <instance instanceCode="1" objectCode="sugsh02_object">
    <CustomInformation>
    <ColumnValue name="string1">&lt;![CDATA[$ {Var}]]&gt;</ColumnValue>
    </CustomInformation>
    </instance>
    </customObjectInstances>
    </NikuDataBus>

    ---------------

     

    The result is below.  &lt;![CDATA[$ {Var}]]&gt;  is translated to  <![CDATA[$ {Var}]]>

    You mentioned "& gt;". Does it have blank? If so, please use "&gt;" instead of "& gt;".

     

    Regards,

    Shoichi



  • 5.  Re: How to insert <! [CDATA [$ {Var}] into a field of an object via xog?

    Posted 08-07-2018 10:48 PM

    yes, I did just that, but it had not worked, so by chance my answer appeared with white space. I'm going to do another test here. Thank you