#38672 [NEW]: asXML outputs elements added with addChild() on the same line
| From: | stefano dot comarin at primeur dot com | Date: | Thu, 31 Aug 2006 14:59:41 +0000 |
| Subject: | #38672 [NEW]: asXML outputs elements added with addChild() on the same line | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-101574@lists.php.net to get a copy of this message | ||
From: stefano dot comarin at primeur dot com
Operating system: Windows 2000
PHP version: 5.1.6
PHP Bug Type: SimpleXML related
Bug description: asXML outputs elements added with addChild() on the same line
Description:
------------
If you add elements with addChild() and then call asXML() the added
elements are printed on the same line. This makes the XML difficult to
read.
Reproduce code:
---------------
<?php
$xmlstr = <<<XML
<a>
<b>bbb</b>
</a>
XML;
$xml = new SimpleXMLElement($xmlstr);
$xml->addChild('c', 'ccc');
$xml->addChild('d', 'ddd');
echo $xml->asXML();
?>
Expected result:
----------------
<?xml version="1.0"?>
<a>
<b>bbb</b>
<c>ccc</c>
<d>ddd</d>
</a>
Actual result:
--------------
<?xml version="1.0"?>
<a>
<b>bbb</b>
<c>ccc</c><d>ddd</d></a>
--
Edit bug report at http://bugs.php.net/?id=38672&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38672&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38672&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38672&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38672&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=38672&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38672&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38672&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38672&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38672&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38672&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=38672&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=38672&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38672&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38672&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38672&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38672&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38672&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38672&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38672&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38672&r=mysqlcfg