API:
[lhc/web/wiklou.git] / includes / api / ApiFormatXml.php
index f4bf838..c811444 100644 (file)
@@ -1,12 +1,11 @@
 <?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
@@ -29,6 +28,9 @@ if (!defined('MEDIAWIKI')) {
        require_once ('ApiFormatBase.php');
 }
 
+/**
+ * @addtogroup API
+ */
 class ApiFormatXml extends ApiFormatBase {
 
        private $mRootElemName = 'api';
@@ -50,16 +52,8 @@ class ApiFormatXml extends ApiFormatBase {
        }
 
        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);
        }
 
        /**
@@ -104,8 +98,6 @@ class ApiFormatXml extends ApiFormatBase {
                                $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)) {
@@ -115,7 +107,7 @@ class ApiFormatXml extends ApiFormatBase {
                                }
 
                                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");
@@ -145,23 +137,11 @@ class ApiFormatXml extends ApiFormatBase {
                }
        }
        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
+