|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38672 asXML outputs elements added with addChild() on the same line
Submitted: 2006-08-31 14:59 UTC Modified: 2006-08-31 17:06 UTC
From: stefano dot comarin at primeur dot com Assigned:
Status: Not a bug Package: SimpleXML related
PHP Version: 5.1.6 OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: stefano dot comarin at primeur dot com
New email:
PHP Version: OS:


 [2006-08-31 14:59 UTC] stefano dot comarin at primeur dot com
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:
        $xmlstr = <<<XML
        $xml = new SimpleXMLElement($xmlstr);
        $xml->addChild('c', 'ccc');
        $xml->addChild('d', 'ddd');
        echo $xml->asXML();

Expected result:
<?xml version="1.0"?>

Actual result:
<?xml version="1.0"?>


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-31 17:06 UTC]
That's expected behaviour. The xml extension do not add whitespaces just to make the XML look nice
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 13:01:29 2024 UTC