From:             mike at cocoweb dot co dot uk
Operating system: Win XP
PHP version:      5.0.3
PHP Bug Type:     SimpleXML related
Bug description:  asXML() doesn't work for empty XML elements

Description:
------------
asXML() function generates an XML string which contains invalid XML.


Reproduce code:
---------------
   // Valid XML
   $string =
   "
      <a>
         <b></b>
      </a>
   ";

   // Load the string into the simplexml framework
   $XMLObject = simplexml_load_string($string);

   // View the XML object in string representation.
   echo $XMLObject->asXML();

Expected result:
----------------
      <a>
         <b></b>
      </a>

Actual result:
--------------
      <a>
         <b/>
      </a>

<!-- 

Now the <b> tag is unclosed!  i.e. invalid XML.

I am probably doing something wrong... so please help :o)

I have checked the documentation and examples on other websites all to no
avail.  Couldn't find anything relevant using Google.

-->


-- 
Edit bug report at http://bugs.php.net/?id=32307&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=32307&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=32307&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=32307&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=32307&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=32307&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=32307&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=32307&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=32307&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=32307&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=32307&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=32307&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=32307&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=32307&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=32307&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=32307&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=32307&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=32307&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=32307&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=32307&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=32307&r=mysqlcfg

Reply via email to