Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
ysj
Creator
Creator

XML load error

Hi,

I am trying create reload the dashboard using below condition but not able to do that.

getting below error:

XML document must have a top level element.


Dashboard script Script:


LET vFilePath='\TaskLogIndex\TaskLogIndex_*.xml';

LET vSize =FileSize('$(vFilePath)');  //test the file size

IF vSize > 3000  THEN

LOAD

LogID,

    TaskName,

    Date,

    Time,

    ClusterID,

    FullLogPath,

    FileSize() as fsz

FROM $(vFilePath)(XmlSimple, Table is [Root/LogIndex]);

ENDIF

Thank you,

YJ

6 Replies
Anil_Babu_Samineni

This error occurs when you have extra Tag in your XML code?

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
ysj
Creator
Creator
Author

Thank you anil,

Could you please help me.

I want to load file which is greater than 3 KB but my IF condition doesnt work properly.

please provide your thoughts.

Anil_Babu_Samineni

Try this?

LET vSize = filesize(myfile);

IF '$(vSize)' > 3000 THEN

  LOAD * FROM myfile;

ENDIF


So, In your expression you may forget this?

LET vFilePath='\TaskLogIndex\TaskLogIndex_*.xml';

LET vSize =FileSize('$(vFilePath)');  //test the file size

IF '$(vSize)' > 3000  THEN

LOAD

LogID,

    TaskName,

    Date,

    Time,

    ClusterID,

    FullLogPath,

    FileSize() as fsz

FROM $(vFilePath)(XmlSimple, Table is [Root/LogIndex]);

ENDIF

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
avinashelite

IF $(vSize) > 3000 then


...


ENDIF

jonathandienst
Partner
Partner

In spite of the previous comments, this syntax is correct, so changing it is not necessary:

IF vSize > 3000  THEN


The error you are getting is that the XML file is not well-formed as it lacks a root (or top-level) element. A well-formed XML dopcument will have the layout


<?xml version="1.0" ?>

<rootnode>

  <elementnode></elementnode>

  <elementnode></elementnode>

  ...

</rootnode>

Your document may be lacking the header node and/or root node

https://www.google.co.za/search?source=hp&q=well-formed+XML&oq=well-formed+XML

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Clever_Anjos
Employee
Employee

You probably are trying to load a corrupted file, would you mind posting it?