ID:               47953
 User updated by:  bbarnett at gt dot co dot cr
 Reported By:      bbarnett at gt dot co dot cr
 Status:           Bogus
 Bug Type:         SimpleXML related
 Operating System: WXP
 PHP Version:      5.2.9
 New Comment:

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();


Previous Comments:
------------------------------------------------------------------------

[2009-04-15 17:46:42] bbarnett at gt dot co dot cr

Excuse too many questions, but I need to resolve this.

if is this true, why if is the same provider for this string in one
case works and in the other none???

Thank's for your help :)

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

[2009-04-15 17:10:14] rricha...@php.net

Not a bug. You have bad data - most likely an invisible char.

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

[2009-04-15 15:58:53] bbarnett at gt dot co dot cr

I'm adding the XML head to the string like this

<?xml version="1.0" encoding="UTF-8"?>
<X_A_PagoGen>
  <Banco>2</Banco>
  <Localizacion>7901160655</Localizacion>
  <NotaCredito>000000009726</NotaCredito>
  <Correlativo>79613565</Correlativo>
  <Self>5</Self>
  <Monto>0000010605</Monto>
  <Agencia>1400</Agencia>
  <FechaPago>20090102</FechaPago>
  <FechaCaja>20090105</FechaCaja>
</X_A_PagoGen>
But I'm receiving the same result. 

In the next case the function read the XML without problem

<X_C_Localizacion>
  <Localizacion>7901160655</Localizacion>
</X_C_Localizacion>

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

[2009-04-15 15:40:06] bbarnett at gt dot co dot cr

I try without the utf8_decode, but I'm receiving the same result.

$xml2= simplexml_load_string(trim($reg[0]));

Can you help me?

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

[2009-04-15 11:55:16] rricha...@php.net

There's bad data somewhere in your XML. No idea what encoding the data

is, but converting it to ISO-8859-1 without an XML declaration using 
that encoding is a sure path to disaster.

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/47953

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

Reply via email to