loadXML from Lotus Notes Agent

I currently use the command ‘loadXML(path/database/view?openview)’ to open a Lotus Notes View that has been modified to create XML data which works correctly when my form is opened.

In order to make the view more robust (and use the Tree Grid), I have an agent that creates the very same XML using Print statements - ‘loadXML(path/database/agent.xml’. When the form is opened, I get Error type: LoadXML; Incorrect XML.

Both the view and agent render the XML correctly when opening directly through a URL.

Why would XML created through Print statements in an agent that is called as the URL in the loadXML fail?

Here is the format of xml supported by dhtmlxgrid:
docs.dhtmlx.com/doku.php?id=dhtm … _templates
If your result format differes from it you need to change it to the supported one, or create your own xml type in dhtmlxgrid according to the following tutorial:
docs.dhtmlx.com/doku.php?id=dhtm … s_creation