summaryrefslogtreecommitdiffstats
path: root/lib/api.php
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-01-31 14:39:31 -0800
committerThomas Müller <thomas.mueller@tmit.eu>2013-01-31 14:39:31 -0800
commitcaec0c476de8c0f337c58b049b9a4360aa593706 (patch)
tree13212f0fe3914eb1ac23912dd8d3dd5215b9bdcf /lib/api.php
parenta9e1c9bf6d65d3f7613a40c99ec34caec19d26e3 (diff)
parentb26279546c78618b167e4a8e7a4a10db01c7d479 (diff)
downloadnextcloud-server-caec0c476de8c0f337c58b049b9a4360aa593706.tar.gz
nextcloud-server-caec0c476de8c0f337c58b049b9a4360aa593706.zip
Merge pull request #1287 from owncloud/ocs_xml_attributes
API: Treat array keys starting with '@' as XML attributes
Diffstat (limited to 'lib/api.php')
-rw-r--r--lib/api.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/api.php b/lib/api.php
index 545b55757ff..abf1c3b0036 100644
--- a/lib/api.php
+++ b/lib/api.php
@@ -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();