ID:               41405
 User updated by:  longrennet at hotmail dot com
 Reported By:      longrennet at hotmail dot com
 Status:           Bogus
 Bug Type:         *General Issues
 Operating System: Linux ES3
 PHP Version:      5.2.2
 New Comment:

Thanks for Ur help


Previous Comments:
------------------------------------------------------------------------

[2007-05-17 09:39:44] [EMAIL PROTECTED]

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()

------------------------------------------------------------------------

[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] [EMAIL PROTECTED]

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

Reply via email to