API: If key begins with '@' treat it as an xml attribute

remotes/origin/stable5
Tom Needham 12 years ago
parent 8f9d3cd01d
commit 02f8c941f4
  1. 9
      lib/api.php

@ -188,10 +188,15 @@ class OC_API {
} }
private static function toXML($array, $writer) { private static function toXML($array, $writer) {
foreach($array as $k => $v) { 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'; $k = 'element';
} }
if(is_array($v)) { if(is_array($v)) {
$writer->startElement($k); $writer->startElement($k);
self::toXML($v, $writer); self::toXML($v, $writer);
@ -199,7 +204,9 @@ class OC_API {
} else { } else {
$writer->writeElement($k, $v); $writer->writeElement($k, $v);
} }
} }
} }
} }

Loading…
Cancel
Save