note 56119 deleted from ref.xml by bjori
| From: | bjori@php.net | Date: | Mon, 09 Oct 2006 11:12:51 +0000 |
| Subject: | note 56119 deleted from ref.xml by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-118285@lists.php.net to get a copy of this message | ||
Note Submitter: BinnyVA
----
The 'xml2array' functions(see below) have a small problem - they will ignore the
Empty-element tags - ie. the tags that close themselves. An example...
<IMG align="left" src="http://www.w3.org/Icons/WWW/w3c_home"
/>
If you wish to access the attributes of these tags, use this code before calling the function.
<?php
$data = file_get_contents("atom.xml");
$data =
preg_replace('/<(\w+)([^>]*)\/>/s','<\1\2></\1>',$data);
$xml_data = xml2array($data);
?>
I have not modified the function in anyway. There are two versions(HansP's and guyemup's)
of the same function. This code was made for the older one - guyemup's function - but can be
used with the other variation with some slight modifications.