mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Merge pull request #1287 from owncloud/ocs_xml_attributes
API: Treat array keys starting with '@' as XML attributes
This commit is contained in:
commit
caec0c476d
1 changed files with 5 additions and 2 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue