[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[TYPO3-dev] t3div_lib::array2xml problem when encounters multiples of the same tag


  • From: brikou at gmail.com (Brice Bernard)
  • Date: Sun, 1 Jan 2006 23:18:29 +0100

Hi all and happy new year 2006!

As Sebastian Kuerfuest advised me, I also post this bug to the dev list (not
only the bug tracker)... but you still can find it there
http://bugs.typo3.org/view.php?id=2149

when parsing this xml code (taken as an example from php.net):

<?xml version="1.0"?>
<moldb>

   <molecule>
       <name>Alanine</name>
       <symbol>ala</symbol>
       <code>A</code>
       <type>hydrophobic</type>
   </molecule>

   <molecule>
       <name>Lysine</name>
       <symbol>lys</symbol>
       <code>K</code>
       <type>charged</type>
   </molecule>

</moldb>

we have this array :

Array
(
   [molecule] => Array
       (
           [name] => Lysine
           [symbol] => lys
           [code] => K
           [type] => charged
       )
)

The tags are overwriting it would be great to obtain this instead (when
multiple tags...) :

Array
(
   [molecule] => Array
       [0] =>
               (
                   [name] => Alanine
                   [symbol] => ala
                   [code] => A
                   [type] => hydrophobic
               )
               [1] =>
               (
                   [name] => Lysine
                   [symbol] => lys
                   [code] => K
                   [type] => charged
               )
)

I also find an example resolving this problem here
http://fr.php.net/manual/fr/function.xml-parse-into-struct.php (see note
from vampboy).

--
- Brice -