|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-04-11 23:49 UTC] bbarnett at gt dot co dot cr
Description: ------------ I'm receiving and error when I try to read and XML string. The error is: Premature end of data in tag FechaPago line 9 Line: 9 Reproduce code: --------------- $xml2= simplexml_load_string(utf8_decode(trim($reg[0]))); Expected result: ---------------- An XML object Actual result: -------------- An Error. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 01:00:01 2025 UTC |
This is a part of the code that I'm using: <? $consulta="select trama from gestiones where consecutivo=".trim($_REQUEST['consecutivo']); $buffconsulta = mssql_query($consulta,$conn); $reg = mssql_fetch_row($buffconsulta); // Procesa el XML enviado $xml2= simplexml_load_string(utf8_decode(trim($reg[0]))); if (!$xml2){ print wordwrap($reg[0], 30, "<br>",1); } ?>I don't know why this issue was clasified as bogus, because its a PHP error. I wrote again the code to generate the XML that is read it in other company without problem, but when I try to read it, I'm receiving the same error reported before. There are not hidden characters that I put like Richards wrote before. Please help me with this problem // Crea objeto XML $doc = new DOMDocument('1.0'); $doc->formatOutput = true; $root = $doc->createElement('X_A_PagoGen'); $root = $doc->appendChild($root); $title = $doc->createElement('Banco'); $title = $root->appendChild($title); $text = $doc->createTextNode(trim($codigobanco)); $text = $title->appendChild($text); $title = $doc->createElement('Localizacion'); $title = $root->appendChild($title); $text = $doc->createTextNode(trim($localizacion)); $text = $title->appendChild($text); $title = $doc->createElement('NotaCredito'); $title = $root->appendChild($title); $text = $doc->createTextNode(llenacampo(trim($remesa),12,'0','derecha')); $text = $title->appendChild($text); $title = $doc->createElement('Correlativo'); $title = $root->appendChild($title); $text = $doc->createTextNode(trim($factura)); $text = $title->appendChild($text); $title = $doc->createElement('Self'); $title = $root->appendChild($title); $text = $doc->createTextNode(trim($self)); $text = $title->appendChild($text); $title = $doc->createElement('Monto'); $title = $root->appendChild($title); $text = $doc->createTextNode(llenacampo(trim($monto),10,'0','derecha')); $text = $title->appendChild($text); $title = $doc->createElement('Agencia'); $title = $root->appendChild($title); $text = $doc->createTextNode(trim($recaudadorCNFL)); $text = $title->appendChild($text); $title = $doc->createElement('FechaPago'); $title = $root->appendChild($title); $text = $doc->createTextNode(trim(fecha1())); $text = $title->appendChild($text); $title = $doc->createElement('FechaCaja'); $title = $root->appendChild($title); $text = $doc->createTextNode(trim($deposito)); $text = $title->appendChild($text); $tramaxml=$doc->saveXML();