Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
marco_puccetti
Partner - Creator
Partner - Creator

Xml Parsing

Hello, i need to access, some XML text fields and get some values from it, is it possible?

If so, how can i do this?

Thanks

Marco

14 Replies
Not applicable

yes

xml data can be retireved from either a file or web page.

In scripting on the Load, you can select table files, if the xml file is saved or you can select web page.  If you slect table files, once you point to the file in the wizard, make sure the file type is XML

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Where do you want to get these XML fields from? A regular XML (data) file? Or an online XML source?

The QlikView script can read data files in XML format, after which you can pick up the values you want to keep.

pamaxeed
Partner - Creator III
Partner - Creator III

Ciao Marco,

you can just use the wizard, load table file and choose xml type like below, you should get the parsed xml file in the preview window:

Cheers,

Patric

marco_puccetti
Partner - Creator
Partner - Creator
Author

I need to load dinamically Some Xml values from a table in which is not present only xml but also standard text and numerical values.

How can i do this?

Thanks

Marco

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Can you post an example of the table you want to load in this thread? XML-formatted files can vary wildly in syntax and layout, and a solution for one format may not always work for another.

Best,

Peter

marco_puccetti
Partner - Creator
Partner - Creator
Author

This is the table with the xml field.

Immagine17.png

Thanks

Marco

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Ah, I see...

What you could do is create a table import-column export QVW document that simply saves the column with XML-formatted data to an external file (for example a .csv with a single column and a column title that consists of the XML header lines). Next you only need to read this new file using the technique suggested before...

Best,

Peter

marco_puccetti
Partner - Creator
Partner - Creator
Author

I need to know if exists some function that allow me to get specific field inside the xml (XSL functions or other).

Thanks

Marco

martynlloyd
Partner - Creator III
Partner - Creator III

Hi, you could use Replace() to strip off the XML tags:

Replace(

  Replace(YourField,'VRCSM',''),

    '<CDISPTROPR', '')

etc.

AS ValueInXML;

Or even better:

// 1 Build map of tags

XMLTag_Map:

MAPPING
LOAD DISTINCT
'<' &
TextBetween('<' & SubField(XMLTEXT, '<', IterNo()),'<','>') & '>' as XMLTag,
''
as Substitute 
Resident YourTable
While NOT IsNull(SubField(XMLTEXT, '<', IterNo())); 

// 2 Use map to replace tags

...
,
Trim(RTrim(Replace(
Replace( MapSubstring('XMLTag_Map', XMLTEXT),'&amp;','&')
,'&quot;','"')))
as XMLTEXT_Cleansed 

Post the data and I'll make it for you.

kind regards, Marty.