Edit report at http://bugs.php.net/bug.php?id=53044&edit=1

 ID:                 53044
 Updated by:         rricha...@php.net
 Reported by:        bbarnetm at yahoo dot com
 Summary:            Invalid Nodetype to import
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            DOM XML related
 Operating System:   W2K3
 PHP Version:        5.2.14
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php




Previous Comments:
------------------------------------------------------------------------
[2010-10-12 06:55:14] bbarnetm at yahoo dot com

I modified my script following your tip I founded enough information for
incluye 

aditional lines:

$xmlestilos=ereg_replace("[\\Ð]+","",($xmlestilos));

$xmlestilos=ereg_replace("[\\ð]+","",($xmlestilos));





The script was modified:

if (!($dom->loadXML($xmlestilos))){

        $errors = libxml_get_errors();

        foreach ($errors as $error) {

                echo display_xml_error($error, $xmlestilos);

        }                               

        libxml_clear_errors();                                                  
                

}



Thank very much for your tip.



Let me know if in a future versions you will increment the power of xml


functions?

------------------------------------------------------------------------
[2010-10-12 05:55:34] cataphr...@php.net

I'd guess the DOMDocument object is empty because the call to loadXML()
failed.



You should do 



if (!$dom->loadXML(...)) {

    //error loading XML. Call libxml_get_errors() to get details

}



not



if (!$dom) {



Please confirm this is the case.



In any case, the error message could be better...

------------------------------------------------------------------------
[2010-10-11 21:22:24] bbarnetm at yahoo dot com

function acentos($valor){

        //Le elimina los acentos al string recibido

        $registro=$valor;

        $registro=ereg_replace("á","a",($registro));

        $registro=ereg_replace("é","e",($registro));

        $registro=ereg_replace("í","i",($registro));

        $registro=ereg_replace("ó","o",($registro));

        $registro=ereg_replace("ú","u",($registro));

        $registro=ereg_replace("Á","A",($registro));

        $registro=ereg_replace("É","E",($registro));

        $registro=ereg_replace("Í","I",($registro));

        $registro=ereg_replace("Ó","O",($registro));

        $registro=ereg_replace("Ú","U",($registro));

        $registro=ereg_replace("ñ","n",($registro));

        $registro=ereg_replace("Ñ","N",($registro));

        return $registro;

}

------------------------------------------------------------------------
[2010-10-11 21:14:18] bbarnetm at yahoo dot com

Description:
------------
While I'm trying to import an extensive xml, I'm recieving the same
error while I 

try to transale to simple xml.

Test script:
---------------
libxml_use_internal_errors(true);

                                
$xmlestilos=ereg_replace(chr(160),"",(trim($reg[0])));

$xmlestilos=ereg_replace('"',"",$xmlestilos);

$xmlestilos=ereg_replace(",",".",$xmlestilos);

                                
$xmlestilos=ereg_replace("&","",$xmlestilos);

$xmlestilos=ereg_replace("&gt","",$xmlestilos);

$xmlestilos=ereg_replace("}","",$xmlestilos);

$xmlestilos=ereg_replace("#","",$xmlestilos);

$xmlestilos=ereg_replace("`","",$xmlestilos);

$xmlestilos=ereg_replace(";","",$xmlestilos);

                                
$xmlestilos=ereg_replace("[\\|]+","",$xmlestilos);

                                
$xmlestilos=ereg_replace("[\\]+","/",$xmlestilos);

$xmlestilos=ereg_replace("¦","",($xmlestilos));

$xmlestilos=ereg_replace("º","",($xmlestilos));

$xmlestilos=ereg_replace("´","",($xmlestilos));

$xmlestilos=ereg_replace("¨","",($xmlestilos));

                                
$xmlestilos=ereg_replace("[\\?]+","",($xmlestilos));

$xmlestilos=ereg_replace("[\\¿]+","",($xmlestilos));

$xmlestilos=acentos($xmlestilos);

$xmlestilos=stripslashes($xmlestilos);

$xmlestilos=utf8_decode($xmlestilos);

$dom = new domDocument;

$dom->loadXML($xmlestilos);

if (!$dom) {

//Escribe la respuesta en un archivo

$formato1 = '%d%m%Y'; $hoyes = strftime($formato1);
$archivolog="estilos_".$hoyes.".log"; 

if (file_exists($archivolog)){unlink($archivolog);}

$fp = fopen ($archivolog, "a");

//fwrite ($fp, trim($reg[0]). PHP_EOL);

fwrite ($fp, trim($xmlestilos). PHP_EOL);

fclose($fp);

print 'MSG-18: SE DETECTO UNA RESPUESTA INVALIDA DEL INS'; die();

} 

                                

$xml = simplexml_import_dom($dom);

Expected result:
----------------
The xml imported in a simple xml object

Actual result:
--------------
Warning: simplexml_import_dom() [function.simplexml-import-dom]: Invalid
Nodetype 

to import in E:\SITIOS\PayWebCoopemex\INS\ins-405.srv.php on line 149


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53044&edit=1

Reply via email to