ID: 38580
Updated by: [EMAIL PROTECTED]
Reported By: dandrikop at cosmote dot gr
-Status: Open
+Status: Feedback
Bug Type: DOM XML related
Operating System: Fedora Core 5
PHP Version: 5.1.5
New Comment:
Warning: DOMDocument::validate(): I/O warning : failed to load external
entity "clickatell.dtd" in /tmp/1.php on line 33
Warning: DOMDocument::validate(): Could not load the external subset
"clickatell.dtd" in /tmp/1.php on line 33
Previous Comments:
------------------------------------------------------------------------
[2006-08-24 10:30:51] dandrikop at cosmote dot gr
Description:
------------
The PHP DOM extension cannot resolve entities declared in an external
DTD file.
Reproduce code:
---------------
<?php
$imp = new DOMImplementation();
$dtd = $imp->createDocumentType( 'clickAPI', null,
'clickatell.dtd' );
$xml_request = $imp->createDocument( null, null, $dtd );
$xml_request->version = '1.0';
$xml_request->encoding = 'ISO-8859-1';
$xml_request->formatOutput = true;
$xml_request->resolveExternals = true;
$xml_request->substituteEntities = true;
$xml_request->standalone = false;
// 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 &testme;"
) );
$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:
----------------
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE clickAPI SYSTEM "clickatell.dtd">
<clickAPI>
<sendMsg>
<session_id>aaaaaaaaaaaaaaaaa</session_id>
<text>Test HELLO</text>
<to>306978888888</to>
</sendMsg>
</clickAPI>
Actual result:
--------------
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE clickAPI SYSTEM "clickatell.dtd">
<clickAPI>
<sendMsg>
<session_id>aaaaaaaaaaaaaaaaa</session_id>
<text>Test &testme;</text>
<to>306978888888</to>
</sendMsg>
</clickAPI>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38580&edit=1