Edit report at http://bugs.php.net/bug.php?id=53044&edit=1
ID: 53044 User updated by: bbarnetm at yahoo dot com Reported by: bbarnetm at yahoo dot com Summary: Invalid Nodetype to import -Status: Feedback +Status: Open Type: Bug Package: DOM XML related Operating System: W2K3 PHP Version: 5.2.14 Block user comment: N New Comment: 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? Previous Comments: ------------------------------------------------------------------------ [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(">","",$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