Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ali_hijazi
Partner - Master II
Partner - Master II

parse xml columns in qlik sense

Hello

I'm reading a table from SQL database

the table has a column of type xml

how can I parse this column in script? or is there another approach?

kindly advise

I can walk on water when it freezes
2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Here's the general idea:

Rawdata:

LOAD *

;

SELECT Id, Name, Whatever, myxml from MyTable;

xmldata:

LOAD

     blah

FROM FIELD (Rawdata, myxml) (XmlSimple, Table is [foo]);

The easiest way to generate the "blah" and "foo" bits is to save one of the "myxml" rows in an xml file and use the table files wizard to generate the xml load statement.

If the values in your xml column don't have an enclosing element, then you may need to fake one in as shown in this thread.

Need assistance for importing data with XML

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

flottmen
Contributor
Contributor

Rob,

I am able to get all of this to work.  Now that the FROM_FIELD load is parsing the XML I can not figure out how to join it back to the original data set.  It seems that the FROM_FIELD script only has access to what is in the XML file (there is no key) there.  This XML is a column from a row in a larger data set and I need to be able to join it back to the original data set to reconnect it with the rest of the data from that particular row.

For what its worth, the original dataset is being pulled from a SQL db.  My hope is to do the XML parsing on the Qlik side as to save the DB from the pressure of the XQuery.