#41405 [Opn->Bgs]: asXML() does not return the whole xml
| From: | rrichards@php.net | Date: | Thu, 17 May 2007 09:39:45 +0000 |
| Subject: | #41405 [Opn->Bgs]: asXML() does not return the whole xml | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-112728@lists.php.net to get a copy of this message | ||
ID: 41405
Updated by: rrichards@php.net
Reported By: longrennet at hotmail dot com
-Status: Open
+Status: Bogus
Bug Type: *General Issues
Operating System: Linux ES3
PHP Version: 5.2.2
New Comment:
It does return well formed XML.
I repeat - You cannot see it correctly in your browser
the browser doesn't display the element tags
Try your code under CLI or escape the output with htmlentities()
Previous Comments:
------------------------------------------------------------------------
[2007-05-17 01:21:47] longrennet at hotmail dot com
SimpleXMLElement->asXML() is described as follow:
SimpleXMLElement->asXML() -- Return a well-formed XML string based on
SimpleXML element.
But here just return the values of nodes, not a well-formed XML. And it
will return nothing, if each node has no value. I need to the
well-formed XML string, but these values.
------------------------------------------------------------------------
[2007-05-16 11:50:42] rrichards@php.net
Works fine. Try viewing the actual output and not what you see in the
browser.
------------------------------------------------------------------------
[2007-05-16 02:00:32] longrennet at hotmail dot com
Description:
------------
I'd like to print the xml string in my code, so i use function asXML().
But it just return the element value in the xml.
Is the code before i use asXML effort it?
Reproduce code:
---------------
<?php
..........
..........
..........//Here is some code. If there is no these codes,it will be
OK.
$string = <<<XML
<a>
<b>
<c>text</c>
<c>stuff</c>
</b>
<d>
<c>code</c>
</d>
</a>
XML;
$xml = new SimpleXMLElement($string);
echo $xml->asXML();
?>
Expected result:
----------------
<?xml version="1.0"
?><a><b><c>text</c><c>stuff</c></b><d><c>code</c></d></a>
Actual result:
--------------
text stuff code
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41405&edit=1