diff --git a/lib/api.php b/lib/api.php index 64b2f0fe9c..47318d4ae1 100644 --- a/lib/api.php +++ b/lib/api.php @@ -188,18 +188,25 @@ class OC_API { } private static function toXML($array, $writer) { + foreach($array as $k => $v) { - if (is_numeric($k)) { + if (substr($k, 0, 1) === '@') { + $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(); } else { $writer->writeElement($k, $v); } + } + } }