"Error type: :loadXML Description: Incorrect XML"

It sounds self explanatory, but it’s not. When my XML would not work, I got an example from the docs, https://docs.dhtmlx.com/tutorials__dhtmlxgrid_basic__step3.html It does not work either. I tried loading from a file and hard coding the xml into the JavaScript, no luck.

The app I am working on is old so because of other dependencies its trapped at JQuery v1.4 and version 2.6 of XGrid. I am not sure if that is a contributing cause.

So here is the sample page. What am I missing here?

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript" language="Javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="xgrid/javascript/dhtmlxcommon.js"></script>
<script type="text/javascript" src="xgrid/javascript/dhtmlxgrid.js"></script>
<script type="text/javascript" src="xgrid/javascript/dhtmlxgridcell.js"></script>
<script type="text/javascript" src="xgrid/javascript/dhtmlxgrid_srnd.js"></script>
<script type="text/javascript" src="xgrid/javascript/dhtmlxgrid_splt.js"></script>

<script>
$(document).ready(function(){
	  mygrid = new dhtmlXGridObject("xgridTable");
	  mygrid.setHeader("Name,Quantity,Price"); 
	  mygrid.setInitWidths("200,150,150");
	  mygrid.setColAlign("left,right,right");
	  mygrid.setSkin("light");

	  xml = '<?xml version="1.0" encoding="iso-8859-1"?><rows><row id="a"><cell>book 1</cell><cell>300</cell><cell>50</cell></row><row id="b"><cell>book 2</cell><cell>2147</cell><cell>43</cell></row><row id="c"><cell>book 3</cell><cell>7488</cell><cell>100</cell></row></rows>';
	  mygrid.loadXML('data1.xml');
	  mygrid.init();
	
});



</script>


</head>
<body>
<div id='xgridTable'>xgridTable</div>
</body>
</html>


Please, try to use the following:
mygrid.init();
xml = ‘<?xml version="1.0" encoding="iso-8859-1"?>book 130050book 2214743book 37488100’;
mygrid.parse(‘data1.xml’);

Do you mean this?

mygrid.parse(xml);

I put that in and the error went away, but the data is not displaying. Do I need some kind of load statement after parse?

  1. You need to init() your grid before the data loading.
  2. In case of loading the data from the local object you need to use the parse() method. (load() id for the loading the data from the external files)
    Please, refer to the following snippet:
    snippet.dhtmlx.com/4ba94776f