Brion Vibber schreef:
The basic problem seems to be overloading of attributes and sub-elements in the same array, which means you can't have both very consistently. It makes it hard to use it as a general-purpose XML output system.
If I could do this:
array( 'attrib1' => 'val1', 'attrib2' => 'val2', '*' => array( 'tag' => 'stuff' 'tag2' => 'stuff2', ) )
then that might do the job, but it doesn't seem to happy with that currently:
Warning: htmlspecialchars() expects parameter 1 to be string, array given in /Library/WebServer/Documents/trunk/includes/Xml.php on line 31
Of course that gives a warning, since the '*' element is supposed to contain text. IIRC, the following should work:
array( 'attrib1' => 'val1', 'attrib2' => 'val2', array( 'tag' => 'stuff', 'tag2' => 'stuff2', ) )
If it doesn't, we should correct the formatter so that it does. Introducing _attribs is also not a very good idea considering how that looks in other formats.
Roan Kattouw (Catrope)