|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-06-07 11:47 UTC] breakpoint at gazeta dot pl
Description:
------------
DOM in PHP5 eating ( ;-) ) close tag when I add tag <param>. I expected <param ..></param> or <param/>. but DOM get <param> with out </param> :-(
Sorry for my english - look in Reproduce code, and Expected and Actual results.
Reproduce code:
---------------
<?php
$objDOM = new DOMDocument();
$objConfig = $objDOM->createElement('config');
$objDOM->appendChild($objConfig);
$objSettings = $objDOM->createElement('settings');
$objConfig->appendChild($objSettings);
for($i=0; $i<10; $i++) {
$objParam = $objDOM->createElement('param'); //HERE!!
$objParam->SetAttribute('name', '11');
$objParam->SetAttribute('value', '22');
$objConfig->appendChild($objParam);
}
echo htmlspecialchars($objDOM->saveHTML());
?>
Expected result:
----------------
<config><settings></settings><param name="11" value="22"></param><param name="11" value="22"></param><param name="11" value="22"></param><param name="11" value="22"></param><param name="11" value="22"></param><param name="11" value="22"></param><param name="11" value="22"></param><param name="11" value="22"></param><param name="11" value="22"></param><param name="11" value="22"></param></config>
Actual result:
--------------
<config><settings></settings><param name="11" value="22"> <param name="11" value="22"> <param name="11" value="22"> <param name="11" value="22"> <param name="11" value="22"> <param name="11" value="22"> <param name="11" value="22"> <param name="11" value="22"> <param name="11" value="22"> <param name="11" value="22"></config>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 30 02:00:01 2025 UTC |
I forget, whe we change line $objParam = $objDOM->createElement('param'); //HERE!! to for example $objParam = $objDOM->createElement('params'); //HERE!! sampel work fine...