loadXML error

We are currently displaying the data in the grid using the following method call


This xml file is created at the server side when a checkbox is selected and the client picks it up and displays it in the grid.Its producing LoadXML error.pls help how to fix it.LoadXML error is generated only when its tested on remote link,but not while the code is run localy on machine.

The issue can be caused by some timing or incorrect XML generation issues
Please check
dhtmlx.com/docs/products/dhtmlxG … rt_comprob

Can u pls say wat u mean by timing error?

The problem can occurs if you loading data not directly from server side script, but creating temporary XML file. In such case situation possible that XML file not fully saved yet on moment when request for it received. The error will not occur if you are loading data directly from server side script.

Still, the most common issue not timing but incorrect content-type - details described in above link.

its timing issue for sure…any ideas how to resolve it…i think the rest of script is running to load the file,wana keep it looping til the file got created…any clues?

The best approach is to load data directly through server script
Instead of

You can use
where some.php contains next logic
- ask data from DB
- form XML data
- output it to stdout

in such case you will not use static XML file, but will send it directly to client - which will remove any timing related issues.

Is thr any chances that this problem be created while xml creation,ie encoding problem,maximum no. of columns or special characters?since data is taken from db and xml file is created…

if so pls help out how to escape special characters…

Thought many possibilities,like timing issue,finally it seems that file is not even created and thus showing

Error Type:LoadXML
Description:Incorrect XML

=>the file creation process is as follows

private void fileCreation(ArrayList nameList)
try {
             DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
             DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
             Document doc = documentBuilder.newDocument();
             Element root = doc.createElement(“rows”);
             int count = 0;
             Iterator itr = nameList.iterator();
             while (itr.hasNext())
 {            xxxDTO obj = (xxxDTO)itr.next();
               if("".equals(obj.getNo().trim()) && “”.equals(obj.getName().trim()))
                   {    continue;    }
                 Element childElement = doc.createElement(“row”);
                  Element rowChildElement = doc.createElement(“cell”);
                  Element rowChildElement2 = doc.createElement(“cell”);
                  Element rowChildElement3 = doc.createElement(“cell”);
           TransformerFactory tranFactory = TransformerFactory.newInstance();
           Transformer aTransformer = tranFactory.newTransformer();
           Source src = new DOMSource(doc);
           String fileLoc = getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
            if(fileLoc.indexOf(“WEB-INF”) != -1)
           {  fileLoc = fileLoc.substring(0,fileLoc.indexOf(“WEB-INF”)); }
           File file = new File(fileLoc+"/filename.xml");
            Result dest = new StreamResult(file);
            aTransformer.transform(src, dest);
 catch (FactoryConfigurationError fce)
 {   System.out.println(“Cannot get the DocumentBuilderFactory instance: " + fce.getMessage());   }
 catch (ParserConfigurationException pce)
 {      System.out.println(“Cannot get the DocumentBuilder instance” + pce.getMessage());   }
 catch(Exception e)
 {     System.out.println(e.getMessage());     }

=>parsed using a jsp file

Can u pls help to fix why loadXML error is thrown in this case.pls help as asap,banging head against wall…