Followup r86622: add initial QUnit test cases for jquery.textSelection module.
[lhc/web/wiklou.git] / includes / api / ApiFormatXml.php
index a09fd47..d76224b 100644 (file)
@@ -1,9 +1,8 @@
 <?php
-
 /**
- * Created on Sep 19, 2006
  *
- * API for MediaWiki 1.8+
+ *
+ * Created on Sep 19, 2006
  *
  * Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
  *
  *
  * You should have received a copy of the GNU General Public License along
  * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
  */
 
 if ( !defined( 'MEDIAWIKI' ) ) {
@@ -29,11 +30,13 @@ if ( !defined( 'MEDIAWIKI' ) ) {
 }
 
 /**
+ * API XML output formatter
  * @ingroup API
  */
 class ApiFormatXml extends ApiFormatBase {
 
        private $mRootElemName = 'api';
+       public static $namespace = 'http://www.mediawiki.org/xml/api/';
        private $mDoubleQuote = false;
        private $mXslt = null;
 
@@ -64,7 +67,7 @@ class ApiFormatXml extends ApiFormatBase {
                }
                $this->printText(
                        self::recXmlPrint( $this->mRootElemName,
-                               $this->getResultData(),
+                               array( 'xmlns' => self::$namespace ) + $this->getResultData(),
                                $this->getIsHtml() ? - 2 : null,
                                $this->mDoubleQuote
                        )
@@ -83,6 +86,13 @@ class ApiFormatXml extends ApiFormatBase {
         *
         * If neither key is found, all keys become element names, and values become element content.
         * The method is recursive, so the same rules apply to any sub-arrays.
+        * 
+        * @param $elemName
+        * @param $elemValue
+        * @param $indent
+        * @param $doublequote bool
+        *
+        * @return string
         */
        public static function recXmlPrint( $elemName, $elemValue, $indent, $doublequote = false ) {
                $retval = '';
@@ -153,7 +163,7 @@ class ApiFormatXml extends ApiFormatBase {
                                                $retval .= self::recXmlPrint( $subElemId, $subElemValue, $indent );
                                        }
 
-                                       foreach ( $indElements as $subElemId => & $subElemValue ) {
+                                       foreach ( $indElements as &$subElemValue ) {
                                                $retval .= self::recXmlPrint( $subElemIndName, $subElemValue, $indent );
                                        }
 
@@ -196,7 +206,7 @@ class ApiFormatXml extends ApiFormatBase {
 
        public function getParamDescription() {
                return array(
-                       'xmldoublequote' => 'If specified, double quotes all attributes and content.',
+                       'xmldoublequote' => 'If specified, double quotes all attributes and content',
                        'xslt' => 'If specified, adds <xslt> as stylesheet',
                );
        }