<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Quotes behavior when loading CDATA[] from XML in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Quotes-behavior-when-loading-CDATA-from-XML/m-p/502383#M187707</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Any thoughts on this?&amp;nbsp; I submitted it just before the weekend maintenance so it might have gotten lost.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Aug 2013 20:25:26 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-08-20T20:25:26Z</dc:date>
    <item>
      <title>Quotes behavior when loading CDATA[] from XML</title>
      <link>https://community.qlik.com/t5/QlikView/Quotes-behavior-when-loading-CDATA-from-XML/m-p/502382#M187706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure what to make of this.&amp;nbsp; I'm loading a sql string from an xml file and then doing a Qlikview replace on that sql.&amp;nbsp; Here is the simplified xml:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="xml" __jive_macro_name="code" class="jive_text_macro _jivemacro_uid_13770302161039463 jive_macro_code" jivemacro_uid="_13770302161039463"&gt;
&lt;P&gt;&amp;lt;item&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt;"&gt;&amp;lt;sql&amp;gt;&amp;lt;![CDATA[select 'text' from table]]&amp;gt;&amp;lt;/sql&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;filename&amp;gt;filename.txt&amp;lt;/filename&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;/item&amp;gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's my test script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="_jivemacro_uid_13770302160981745 jive_text_macro jive_macro_code" jivemacro_uid="_13770302160981745"&gt;
&lt;P&gt;XML:&lt;/P&gt;
&lt;P&gt;LOAD trim(sql) as sql_string,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; replace(filename, '.txt', '') as filename&lt;/P&gt;
&lt;P&gt;FROM test.xml (XmlSimple, Table is [dbCallList/item]);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;sql_string:&lt;/P&gt;
&lt;P&gt;LOAD sql_string as sql resident XML where filename = 'filename';&lt;/P&gt;
&lt;P&gt;let vSQL = peek('sql');&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;trace $(vSQL);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;// replace nothing with nothing&lt;/P&gt;
&lt;P&gt;let vSQL = replace('$(vSQL)', '', '');&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;trace $(vSQL);&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output before the replace is:&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13770302160953859" jivemacro_uid="_13770302160953859"&gt;
&lt;P&gt;select 'text' from table&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output after the replace (which should do nothing):&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13770302160891399" jivemacro_uid="_13770302160891399"&gt;
&lt;P&gt;select ''text'' from table&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It adds two single quotes on either side of the string, which make it invalid SQL.&amp;nbsp; Is this weird?&amp;nbsp; Or am i missing something?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Aug 2013 21:02:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Quotes-behavior-when-loading-CDATA-from-XML/m-p/502382#M187706</guid>
      <dc:creator />
      <dc:date>2013-08-16T21:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: Quotes behavior when loading CDATA[] from XML</title>
      <link>https://community.qlik.com/t5/QlikView/Quotes-behavior-when-loading-CDATA-from-XML/m-p/502383#M187707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Any thoughts on this?&amp;nbsp; I submitted it just before the weekend maintenance so it might have gotten lost.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Aug 2013 20:25:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Quotes-behavior-when-loading-CDATA-from-XML/m-p/502383#M187707</guid>
      <dc:creator />
      <dc:date>2013-08-20T20:25:26Z</dc:date>
    </item>
  </channel>
</rss>

