<?php
-
/*
* Created on Sep 19, 2006
*
* API for MediaWiki 1.8+
*
- * Copyright (C) 2006 Yuri Astrakhan <FirstnameLastname@gmail.com>
+ * Copyright (C) 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
require_once ('ApiFormatBase.php');
}
+/**
+ * @addtogroup API
+ */
class ApiFormatXml extends ApiFormatBase {
private $mRootElemName = 'api';
}
public function execute() {
- $xmlindent = null;
- extract($this->extractRequestParams());
-
- if ($xmlindent || $this->getIsHtml())
- $xmlindent = -2;
- else
- $xmlindent = null;
-
$this->printText('<?xml version="1.0" encoding="utf-8"?>');
- $this->recXmlPrint($this->mRootElemName, $this->getResultData(), $xmlindent);
+ $this->recXmlPrint($this->mRootElemName, $this->getResultData(), $this->getIsHtml() ? -2 : null);
}
/**
$subElements = array ();
foreach ($elemValue as $subElemId => & $subElemValue) {
if (gettype($subElemId) === 'integer') {
- if (!is_array($subElemValue))
- ApiBase :: dieDebug(__METHOD__, "($elemName, ...) has a scalar indexed value.");
$indElements[] = $subElemValue;
unset ($elemValue[$subElemId]);
} elseif (is_array($subElemValue)) {
}
if (is_null($subElemIndName) && !empty ($indElements))
- ApiBase :: dieDebug(__METHOD__, "($elemName, ...) has integer keys without _element value");
+ ApiBase :: dieDebug(__METHOD__, "($elemName, ...) has integer keys without _element value. Use ApiResult::setIndexedTagName().");
if (!empty ($subElements) && !empty ($indElements) && !is_null($subElemContent))
ApiBase :: dieDebug(__METHOD__, "($elemName, ...) has content and subelements");
}
}
protected function getDescription() {
- return 'Output data in XML format';
- }
-
- protected function getAllowedParams() {
- return array (
- 'xmlindent' => false
- );
- }
-
- protected function getParamDescription() {
- return array (
- 'xmlindent' => 'Enable XML indentation'
- );
+ return 'Output data in XML format' . parent :: getDescription();
}
public function getVersion() {
return __CLASS__ . ': $Id$';
}
}
-?>
\ No newline at end of file
+