using PHP 5.3.0... and FF 3.0.15
echo( $simpleXMLElement->asXML() ) displays incorrectly in the HTML
console display... while the source is correct, the firebug display
has nodes continually further nested in the previous... which is a
shame because it's nice to be able to debug some simple xml
construction w/ firebug. for a test try this...
<?php
$xmlstr = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<!--
TEST XML
-->
<menu></menu>
XML;
$sxe = new SimpleXMLElement($xmlstr);
$sxe->addAttribute('type', 'test3');
$node = $sxe->addchild( 'item' );
$node->addAttribute( 'title', '01' );
$node->addChild( 'sub_1_1' );
$node->addChild( 'sub_1_2' );
$node2 = $sxe->addchild( 'item' );
$node2->addAttribute( 'title', '02' );
$node2->addChild( 'sub_2_1' );
$node2->addChild( 'sub_2_2' );
$node3 = $sxe->addchild( 'item' );
$node3->addAttribute( 'title', '03' );
$node3->addChild( 'sub_3_1' );
$node3->addChild( 'sub_3_2' );
echo $sxe->asXML();
?>
EXPECTED DISPLAY: (but this is what ends up in the source
<menu type="test3">
<item title="01">
<sub_1_1/>
<sub_1_2/>
</item>
<item title="02">
<sub_2_1/>
<sub_2_2/>
</item>
<item title="03">
<sub_3_1/>
<sub_3_2/>
</item>
</menu>
ACTUAL DISPLAY:
well, you'll have to see for yourself... each node is added as a
child to the previous node... and when you mix the order around a
little and add things in a different order things get less predictable.
--
You received this message because you are subscribed to the Google Groups
"Firebug" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/firebug?hl=.