PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » XML » XML_Tree » Bug #1125

Empty tag like <br /> is not possible

Details

Submitted2004-04-03 23:57 UTC
Fromguillaume dot lecanu at online dot fr
Assigneddavey
StatusClosed
PackageXML_Tree
PHP Version4.3.4
OSDebian Sid
Roadmaps(Not assigned)

Comments

[2004-04-03 23:57 UTC] guillaume dot lecanu at online dot fr

Description:
------------
You cannot make empty tags like <br /> or <img />
The output return this : <br></br>

I have sent a mail on the ML for fix it.

Reproduce code:
---------------
// From the test.php example, i have add 2 lines for make an // "empty tag" 'br' and a standard tag 'span' with a empty value

$tree = new XML_Tree;
$root = $tree->addRoot('MyFriends');
$foo = $root->addChild('name', 'Foo');
$foo = $root->addChild('br');
$foo = $root->addChild('span', '');
$bar = $root->addChild('name', 'Bar', array('age' => 21));
$tree->dump();

Expected result:
----------------
<MyFriends>
<name>Foo</name>
<br></br>
<span></span>
<name age="21">Bar</name>
</MyFriends>

But the good result must be :
<MyFriends>
<name>Foo</name>
<br />
<span></span>
<name age="21">Bar</name>
</MyFriends>