Error type: LoadXML Description: Incorrect XML

Hi,

Trying to understand why I get a Error type: LoadXML Description: Incorrect XML message. I have no problem to display onscreen the xml data, it is only when I want to save the update or modification that I have this error. I am using this code to modify and save data in a MySQL database :





            mygrid = new dhtmlXGridObject(‘grid’);

            mygrid.setImagePath("…/…/…/dhtmlxGrid/codebase/imgs/");

            mygrid.setHeader(“Identifiant,Postfiltre”);

            mygrid.setInitWidths(“200,300”);

            mygrid.setColAlign(“center,left”);

            mygrid.setColTypes(“ed,ed”);

            mygrid.setColSorting(“int,str”);

            mygrid.setSkin(“light”);

            mygrid.init();

            mygrid.loadXML(“grid_co.xml”);        





            myDataProcessor = new dataProcessor(“update_co.php”);

            //myDataProcessor.enableDebug(true);

            myDataProcessor.enableDataNames(true);

            myDataProcessor.setVerificator(1);

            myDataProcessor.setUpdateMode(“off”);//available values: cell (default), row, off

            myDataProcessor.defineAction(“error”,myErrorHandler);

            myDataProcessor.setTransactionMode(“GET”);

            myDataProcessor.init(mygrid);

                        

            //Example of error handler. It gets tag object as incomming argument.

            function myErrorHandler(obj)

            {

                alert(“Error occured.\n”+obj.firstChild.nodeValue);

                myDataProcessor.stopOnError = true;

                return false;

            }





HERE ARE THE LINKS I USE TO ADD, MODIFY, etc. Items :



Ajouter un �l�ment

Supprimer un �l�ment







HERE IS MY UPDATE_CO.PHP :



<?php



//start session (see get.php for details)

session_start();



if(!isset($_SESSION[“id”]))

    $_SESSION[“id”] = microtime();

    

//include db connection settings



$host=“";

$user="
”;

$passeword="***********";



$link = mysql_connect($host, $user, $passeword);

mysql_select_db(’**********’,$link);



//FUNCTION TO USE IN THE CODE LATER



//XML HEADER



//include XML Header (as response will be in xml format)

//if ( stristr($_SERVER[“HTTP_ACCEPT”],“application/xhtml+xml”) ) {

        header(“Content-type: application/xhtml+xml”);

        //header(“Content-type: text/xml”);

//}

echo("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n");



//PREPARE VALUES



if(!empty($_GET[“Postfiltre”]))

{

    if(isset($_GET["!nativeeditor_status"]) && trim($_GET["!nativeeditor_status"])==“inserted”)

    {

        //INSERT

        mysql_query(“INSERT into mots_forum_blog value(’”.$_GET[“Identifiant”]."’,’".$_GET[“Postfiltre”]."’)") or die(“Erreur insertion : “.mysql_error());

            

        //set value to use in response

        $newId = mysql_insert_id();

        $action = “insert”;

        

    }

    else

    {

        if(isset($_GET[”!nativeeditor_status”]) && $_GET["!nativeeditor_status"]==“deleted”)

        {

            //DELETE

            mysql_query(“DELETE FROM mots_forum_blog WHERE id=’”.$_GET[“Identifiant”]."’") or die(“Erreur suppression : “.mysql_error());

            

            //set values to include in response

            $newId = $_GET[“gr_id”];

            $action = “delete”;

        }

        else

        {

            //UPDATE

            //update row

            mysql_query(“UPDATE mots_forum_blog SET mot=’”.$_GET[“Postfiltre”].”’ WHERE id=’”.$_GET[“Identifiant”]."’") or die(“Erreur modification : “.mysql_error());

            

            //set values to include in response

            $newId = $_GET[“gr_id”];

            $action = “update”;

        }

    }

}

?>





    <?php

    if($newId!=0)

    {

        print(””);

    }

    else

    {

        print(“SQL query error”);

    }

    ?>





Thanks for your help

Florent

a) please try to use header(“Content-type: text/xml”); instead of header(“Content-type: application/xhtml+xml”);
text/xml content type works for all versions of browsers, while xhtml+xml only for some

b) the code which you are using seems correct, but please be sure that all data which outputed in XML is in the same encoding as defined in XML header.