<?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: Import XML from MySQL with generic name tags in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Import-XML-from-MySQL-with-generic-name-tags/m-p/1070676#M357652</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I assume that each 'record' is contained inside a &amp;lt;row&amp;gt;&amp;lt;/row&amp;gt; element in &amp;lt;resultset&amp;gt;. If that is the case, you should be able to iterate over the &amp;lt;row&amp;gt; elements and load a record at a time. That should work, but may not scale very well for a file with a large number of &amp;lt;row&amp;gt; elements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have some other ideas but would need some tests (involving from-field and generic loads) for a load method that will scale better.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Apr 2016 08:18:44 GMT</pubDate>
    <dc:creator>jonathandienst</dc:creator>
    <dc:date>2016-04-07T08:18:44Z</dc:date>
    <item>
      <title>Import XML from MySQL with generic name tags</title>
      <link>https://community.qlik.com/t5/QlikView/Import-XML-from-MySQL-with-generic-name-tags/m-p/1070673#M357649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How can I import an XML dump from MySQL in the following format:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: courier new,courier;"&gt;&amp;lt;?xml version="1.0"?&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;&lt;SPAN&gt;&amp;lt;resultset xmlns:xsi="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" rel="nofollow" target="_blank"&gt;http://www.w3.org/2001/XMLSchema-instance&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;&amp;nbsp; &amp;lt;row&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;field name="id"&amp;gt;22&amp;lt;/field&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;field name="client_id"&amp;gt;1&amp;lt;/field&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;field name="name"&amp;gt;ExampleName&amp;lt;/field&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;field name="address"&amp;gt;Some sample street 5&amp;lt;/field&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;field name="zipcode"&amp;gt;&amp;lt;/field&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;field name="city"&amp;gt;Sampletown&amp;lt;/field&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;field name="scope_id"&amp;gt;28&amp;lt;/field&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 8pt;"&gt;&amp;nbsp; &amp;lt;/row&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: courier new,courier;"&gt;&amp;lt;/resultset&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Note that the column tags are all named 'field' with an attribute 'name' containing the actual name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found some sample script to import this into Qlik, but it relied on iterating numerically over all columns and I cannot rely on the order of the fields, so that probably wont work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2016 04:17:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Import-XML-from-MySQL-with-generic-name-tags/m-p/1070673#M357649</guid>
      <dc:creator />
      <dc:date>2016-04-07T04:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: Import XML from MySQL with generic name tags</title>
      <link>https://community.qlik.com/t5/QlikView/Import-XML-from-MySQL-with-generic-name-tags/m-p/1070674#M357650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe this is helpful: &lt;A href="https://community.qlik.com/message/1011053"&gt;Re: Loading attribute from a specific section in XML file&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2016 07:18:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Import-XML-from-MySQL-with-generic-name-tags/m-p/1070674#M357650</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2016-04-07T07:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: Import XML from MySQL with generic name tags</title>
      <link>https://community.qlik.com/t5/QlikView/Import-XML-from-MySQL-with-generic-name-tags/m-p/1070675#M357651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks! Read it, but doesn't really seem to be relevant to my question. The structure in that question is much more exotic but also less generic with differently named tags.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2016 07:28:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Import-XML-from-MySQL-with-generic-name-tags/m-p/1070675#M357651</guid>
      <dc:creator />
      <dc:date>2016-04-07T07:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Import XML from MySQL with generic name tags</title>
      <link>https://community.qlik.com/t5/QlikView/Import-XML-from-MySQL-with-generic-name-tags/m-p/1070676#M357652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I assume that each 'record' is contained inside a &amp;lt;row&amp;gt;&amp;lt;/row&amp;gt; element in &amp;lt;resultset&amp;gt;. If that is the case, you should be able to iterate over the &amp;lt;row&amp;gt; elements and load a record at a time. That should work, but may not scale very well for a file with a large number of &amp;lt;row&amp;gt; elements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have some other ideas but would need some tests (involving from-field and generic loads) for a load method that will scale better.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2016 08:18:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Import-XML-from-MySQL-with-generic-name-tags/m-p/1070676#M357652</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2016-04-07T08:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: Import XML from MySQL with generic name tags</title>
      <link>https://community.qlik.com/t5/QlikView/Import-XML-from-MySQL-with-generic-name-tags/m-p/1070677#M357653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I gave up trying to use the XMLSimple load protocol to get this file (has anyone ever used XmlSax?). This is the script I used:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14600204935983819 jive_text_macro" jivemacro_uid="_14600204935983819" modifiedtitle="true"&gt;
&lt;P&gt;T1:&lt;/P&gt;
&lt;P&gt;LOAD *,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; If(row like '&amp;lt;row&amp;gt;', Alt(Peek(recID), 0)+1, Alt(Peek(recID), 0)) as recID,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; If(row like '&amp;lt;field name=*', TextBetween(row, '"','"')) as fieldname,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; If(row like '&amp;lt;field name=*', TextBetween(row, '&amp;gt;','&amp;lt;')) as fieldvalue&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;LOAD [@1:n] as row, RecNo() as ID&lt;/P&gt;
&lt;P&gt;FROM [GenericXML.xml]&lt;/P&gt;
&lt;P&gt;(fix, codepage is 1252);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;T2:&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;/P&gt;
&lt;P&gt;LOAD * Resident T1&lt;/P&gt;
&lt;P&gt;Where Len(fieldname) &amp;gt; 0&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;DROP Table T1;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;T3:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Generic LOAD recID, fieldname, fieldvalue&lt;/P&gt;
&lt;P&gt;Resident T2&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;Let tableName = 'T3.' &amp;amp; FieldValue('fieldname', 1);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;Result:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;LOAD recID&lt;/P&gt;
&lt;P&gt;Resident T2;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;For i = 1 To FieldValueCount('fieldname')&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Let tableName = 'T3.' &amp;amp; FieldValue('fieldname', i);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Join(Result)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LOAD Distinct * &lt;/P&gt;
&lt;P&gt;&amp;nbsp; Resident [$(tableName)];&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;&amp;nbsp; DROP Table [$(tableName)];&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Next &lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;DROP Table T2;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This produces a table 'Result' that will contain the data correctly structured.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2016 09:19:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Import-XML-from-MySQL-with-generic-name-tags/m-p/1070677#M357653</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2016-04-07T09:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: Import XML from MySQL with generic name tags</title>
      <link>https://community.qlik.com/t5/QlikView/Import-XML-from-MySQL-with-generic-name-tags/m-p/1070678#M357654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also see here &lt;A href="https://community.qlik.com/message/43626"&gt;Extract from XML. Help&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2016 09:28:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Import-XML-from-MySQL-with-generic-name-tags/m-p/1070678#M357654</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2016-04-07T09:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Import XML from MySQL with generic name tags</title>
      <link>https://community.qlik.com/t5/QlikView/Import-XML-from-MySQL-with-generic-name-tags/m-p/1070679#M357655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Any idea how this performs on a large dataset of several MB and 100k+ rows? I haven't been able to try it yet, but it seems that multiple joins on the same dataset and a loop will take its toll on the performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As opposed to the original question, if I were to supply a direct hardcoded mapping from the XML fields to the database columns (field#1 = id, field#2 = name, etc) would it be easier to build a better performing load script?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Apr 2016 08:14:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Import-XML-from-MySQL-with-generic-name-tags/m-p/1070679#M357655</guid>
      <dc:creator />
      <dc:date>2016-04-14T08:14:01Z</dc:date>
    </item>
  </channel>
</rss>

