Merge pull request #1287 from owncloud/ocs_xml_attributes

API: Treat array keys starting with '@' as XML attributes
This commit is contained in:
Thomas Müller 2013-01-31 14:39:31 -08:00
commit caec0c476d

View file

@ -188,10 +188,13 @@ class OC_API {
private static function toXML($array, $writer) {
foreach($array as $k => $v) {
if (is_numeric($k)) {
if ($k[0] === '@') {
$writer->writeAttribute(substr($k, 1), $v);
continue;
} else if (is_numeric($k)) {
$k = 'element';
}
if (is_array($v)) {
if(is_array($v)) {
$writer->startElement($k);
self::toXML($v, $writer);
$writer->endElement();