ID:               38562
 Updated by:       [EMAIL PROTECTED]
 Reported By:      dandrikop at cosmote dot gr
-Status:           Open
+Status:           Bogus
 Bug Type:         DOM XML related
 Operating System: Fedora Core 5
 PHP Version:      5.1.5
 New Comment:

See explanation in bug #26650.


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

[2006-08-23 13:16:37] dandrikop at cosmote dot gr

I used the following line and I got exactly what I had input:

==============================
print $xml_request->getElementsByTagName( 'text' )->item(0)->nodeValue
. "\n";
==============================

Result:
Test 


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

[2006-08-23 10:35:29] dandrikop at cosmote dot gr

Description:
------------
I use the new DOM extension of PHP5. I want to pass special characters
manually in the XML CDATA tags, but special characters such as '&' are
automatically escaped.

Reproduce code:
---------------
<?php

        $imp = new DOMImplementation();
        $dtd = $imp->createDocumentType( 'clickAPI', null,
'xml_dtd.txt' );
        $xml_request = $imp->createDocument( null, null, $dtd );
        $xml_request->version = '1.0';
        $xml_request->formatOutput = true;


        // Create the tag 'clickAPI'.
        $clickAPI = $xml_request->appendChild(  new DOMElement(
'clickAPI' )  );

        // Create the tag 'sendMsg'.
        $sendMsg = $clickAPI->appendChild(  new DOMElement( 'sendMsg' )
 );

        // Add elements under the 'auth' tag.
        $sendMsg->appendChild(  new DOMElement( 'session_id',
'aaaaaaaaaaaaaaaaa' )  );

//      $sendMsg->appendChild(  new DOMElement( 'text', "Test &#10;" ) 
);
        $text = $sendMsg->appendChild(  new DOMElement( 'text' )  );
        $text->appendChild(  new DOMText( "Test &#10;" )  );

        $sendMsg->appendChild(  new DOMElement( 'to', '306978888888' ) 
);


        if( @$xml_request->validate() ){
                echo "OK\n";
        } else {
                echo "Not OK!\n";
        }

        echo "\n" . $xml_request->saveXML() . "\n";
?>

Expected result:
----------------
OK

<?xml version="1.0"?>
<!DOCTYPE clickAPI SYSTEM "xml_dtd.txt">
<clickAPI>
  <sendMsg>
    <session_id>aaaaaaaaaaaaaaaaa</session_id>
    <text>Test &#10;</text>
    <to>306978888888</to>
  </sendMsg>
</clickAPI>

Actual result:
--------------
OK

<?xml version="1.0"?>
<!DOCTYPE clickAPI SYSTEM "xml_dtd.txt">
<clickAPI>
  <sendMsg>
    <session_id>aaaaaaaaaaaaaaaaa</session_id>
    <text>Test &amp;#10;</text>
    <to>306978888888</to>
  </sendMsg>
</clickAPI>


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


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

Reply via email to