Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikView forum consolidation is complete. Labels are now required. LEARN ABOUT LABELS
cancel
Showing results for 
Search instead for 
Did you mean: 
petber_exsitec
Contributor III
Contributor III

XML file invalid at top level / tried xmsax

Hi

I have a problem with reading XML-file. I have upgraded to qlikview server november 2017 sr1 and now have problems reading xml-files.

The xml-files worked in version 11. At the top of the xml-file there is a row starting with <!DOCTYPE. If i manually remove the line it works. The wizard shows the file and I can import / read the XML-file. But with this <!DOCTYPE it's not working.

I have tried to change to xmlsax instead. If I try on my local PC it works with xmlsax but not on the server. I have installed Microsoft msxml version 3 och version 6 on the server but with no luck.

Any suggestions how to solve this?

Best regards

Peter

xml04.png

xml01.png

xml02.png

xml03.png

1 Solution

Accepted Solutions
petber_exsitec
Contributor III
Contributor III

Found this information Qlik Support

Description

In Qlik View and Qlik Sense it appears that you cannot load XML files with Document Type Definition (DTD) content by default
To verify if your XML file contain DTD information, you can simply open it (or save it on your disk if it's from a URL) and check usually the line 2.
You should see something looking like:
<!DOCTYPE random PUBLIC "-//NLM//DTD random "https://xxx/yyyzzz/file.dtd">

Cause

The purpose of a Document Type Definition (DTD) is to define the legal building blocks of an XML document. It defines the document structure with a list of legal elements.​
This behavior is working as designed as by default we dont load xml files with a DTD because they can be used in denial of Service attacks.
This security feature was not available in the previous version of QlikView for instance (11.20)

Resolution

If you want to load XML file with DTD content you will need to disable the setting ProhibitDTD.

For Qlik Sense
  • Stop the Qlik Sense Engine service
  • Go to C:\Programdata\Qlik\Sense\Engine and open the file settings.ini (Make sure you have a backup of this file before doing any changes)
  • Add the following content:
[Settings 7] ProhibitDTD=0
  • Save the file and start the Qlik Sense Engine serviceFor Qlik Sense
For QlikView
  • Stop the QlikView Server service
  • Go to C:\Programdata\QlikTech\QlikViewServer and open the file settings.ini (Make sure you have a backup of this file before doing any changes)
  • Add the following content:
  • Save the file and start the QlikView Server service
[Settings 7] ProhibitDTD=0A workaround could be to load the XML file as fixed record file format and to not load the line with DTD content (usually the first 2 lines) by adding a header.
You can then store the result in another XML file and load it normally in Qlik.
The script would look like this (Note: For Qlik Sense you will need to use library instead of the path directly)
Clean_XML: // Load content of the XML as Fixed Record file format and skip the first two lines LOAD [@1:n] FROM [Path_or_URL_to_the_XML] (fix, codepage is 1252, embedded labels, header is 2 lines);  //Store the result in another XML STORE Clean_XML INTO "C:\temp\temp_xml.xml" (txt); DROP TABLE Clean_XML;  // Start of [temp_xml.xml] LOAD statements Id: LOAD Field1, Field2 FROM  (XmlSimple);

Disclaimer

Access to this article is provided to you as part of your subscription to Qlik Maintenance. This article is deemed to be “Documentation” under the terms of the license agreement applicable to your Qlik software. All rights reserved © QlikTech International AB.

View solution in original post

2 Replies
marcus_sommer
MVP & Luminary
MVP & Luminary

I think this will be helpful: Re: Valid XML no longer supported by Qlik!

- Marcus

petber_exsitec
Contributor III
Contributor III

Found this information Qlik Support

Description

In Qlik View and Qlik Sense it appears that you cannot load XML files with Document Type Definition (DTD) content by default
To verify if your XML file contain DTD information, you can simply open it (or save it on your disk if it's from a URL) and check usually the line 2.
You should see something looking like:
<!DOCTYPE random PUBLIC "-//NLM//DTD random "https://xxx/yyyzzz/file.dtd">

Cause

The purpose of a Document Type Definition (DTD) is to define the legal building blocks of an XML document. It defines the document structure with a list of legal elements.​
This behavior is working as designed as by default we dont load xml files with a DTD because they can be used in denial of Service attacks.
This security feature was not available in the previous version of QlikView for instance (11.20)

Resolution

If you want to load XML file with DTD content you will need to disable the setting ProhibitDTD.

For Qlik Sense
  • Stop the Qlik Sense Engine service
  • Go to C:\Programdata\Qlik\Sense\Engine and open the file settings.ini (Make sure you have a backup of this file before doing any changes)
  • Add the following content:
[Settings 7] ProhibitDTD=0
  • Save the file and start the Qlik Sense Engine serviceFor Qlik Sense
For QlikView
  • Stop the QlikView Server service
  • Go to C:\Programdata\QlikTech\QlikViewServer and open the file settings.ini (Make sure you have a backup of this file before doing any changes)
  • Add the following content:
  • Save the file and start the QlikView Server service
[Settings 7] ProhibitDTD=0A workaround could be to load the XML file as fixed record file format and to not load the line with DTD content (usually the first 2 lines) by adding a header.
You can then store the result in another XML file and load it normally in Qlik.
The script would look like this (Note: For Qlik Sense you will need to use library instead of the path directly)
Clean_XML: // Load content of the XML as Fixed Record file format and skip the first two lines LOAD [@1:n] FROM [Path_or_URL_to_the_XML] (fix, codepage is 1252, embedded labels, header is 2 lines);  //Store the result in another XML STORE Clean_XML INTO "C:\temp\temp_xml.xml" (txt); DROP TABLE Clean_XML;  // Start of [temp_xml.xml] LOAD statements Id: LOAD Field1, Field2 FROM  (XmlSimple);

Disclaimer

Access to this article is provided to you as part of your subscription to Qlik Maintenance. This article is deemed to be “Documentation” under the terms of the license agreement applicable to your Qlik software. All rights reserved © QlikTech International AB.

View solution in original post