Gantt XML error on load

I’ve been messing with the dhtmlx library, including gantt for a couple of weeks and I’ve run across an issue I just can’t seem to solve. The gantt chart works pretty good pointing to a static XML file, but static is rather, well, static.

I’ve written some PHP code to pull data out of my database and format that code to the dhtmlxGantt XML format using SimpleXML, but this issue really has me boggled.

Here’s my output XML, when I load this in with dhtmlxGantt, it complains, but if I change the to it loads top level projects, no tasks. When I revert to the lowercase , I get an error saying the file wasn’t found, which makes no sense, because partial data still gets loaded.

It has to be something with my code since the gantt chart seems to work fine when pointing to a static file. Anyone have any ideas?

A Test Task 2012,10,15 25 15

I’m also noticing when the data is called to load, the URL looks like this:
File (xml/projects2.xml?rnd=1350188750914) is not found

What’s causing it to add the ?rnd= stuff? That’s really annoying, because I don’t have a file with what looks like a unix or epoch time stamp in my file name.

You should not change the case of Task/task, that will not work.
I do not understand what is the error while loading a dynamic content? The time stamp is added to prevent file caching.

Thanks Fedor, it just doesn’t seem to make sense. I’ve even put the output in a text file, same problem. The sample xml in the docs works, but my data isn’t working. I’ve validated it against XML validation, compared the two. I’m just not seeing the problem. Obviously Task shouldn’t work and task should, but for some reason it’s not.

Have you added the header -

I’ve tried it both with and without the xml header with no change.

well, finally - what is the error while loading a dynamic content?

the only error it gives is that it can’t find the document, which is obviously false as it does load in and show the first project line, but no task lines. Plus, I can see in network headers the retrieval of the xml document. It is finding the file and reading the file, but the line for is bad. Only thing I can think of is that my file uses tabs and spaces are preferred at this time. My file is similar but shorter in content/structure to the demo file.

try double quotes in

I was thinking I’d tried that already and sure enough, the text file has double quotes. To test the xml, I put it in a static file, just to eliminate that and other possibilities. However, it just occurred to me, that since my first project doesn’t have a task entry, that could be the issue. (nope)

It’s been a few days since I messed with this so I had to go try some things. I thought I found the problem, I was closing the tag before adding task tag, so the task tag wasn’t properly nested inside the project tag. However changing that hasn’t made it better.

<?xml version="1.0" encoding="UTF-8"?> <projects> <project id="1" name="project_1" startdate="2012,10,17"> <task id="1"> <name>A Test Task</name> <est>2012,10,17</est> <duration>22</duration> <percentcomplete>15</percentcomplete> <predecessortasks></predecessortasks> <childtasks></childtasks> </task> </project> </projects>

you might be able to see the error at under projects button.

you mistyped “percentcompleted” - it is in your xml printed as “percentcomplete”
you miss final “d”.

Sorry we should fix the error message.

p.s. how i found it - i have enabled Firebug and it stopped me at the code line with percentcompleted.

ahhh, yup, works now. Thanks

When we call

gantt.loadData(xml_string, false, false)

…the function dtmlXMLLoaderObject.loadXMLString(xmlString) (dhtmlxcommon.js l.156) is called :


  • @desc: load XML from string
  • @type: private
  • @param: xmlString - xml string
  • @topic: 0  

var parser = new DOMParser();
this.xmlDoc=parser.parseFromString(xmlString, “text/xml”);
catch (e){
this.xmlDoc=new ActiveXObject(“Microsoft.XMLDOM”);

this.onloadAction(this.mainObject, null, null, null, this);

if (this.waitCall){


… but the function onloadAction doesn’t exist !

Ok it work for me with the dhtmlxcommon.js of dhtmlxSuite/libCompiler