https://www.mediawiki.org/wiki/Special:Code/MediaWiki/101912
Revision: 101912
Author: brion
Date: 2011-11-03 23:14:58 +0000 (Thu, 03 Nov 2011)
Log Message:
-----------
* (bug 31878, bug 31542) Fix XML namespace output in API; removed now-unneeded
includexmlnamespace parameter.
Any existing uses of includexmlnamespace should be ignored and harmless.
If output data already includes a specific default namespace as an xmlns
attribute, it is now retained -- so for example the RSD API discovery module
outputs the appropriate namespace instead of the generic API one.
Partial revert of r99135 which added the includexmlnamespace parameter as a
temporary requirement to get the xmlns attribute included.
Followup to r88007 which added the xmlns originally, but in the wrong order so
it overrode existing output data.
Modified Paths:
--------------
trunk/phase3/includes/api/ApiFormatXml.php
Modified: trunk/phase3/includes/api/ApiFormatXml.php
===================================================================
--- trunk/phase3/includes/api/ApiFormatXml.php 2011-11-03 23:09:03 UTC (rev
101911)
+++ trunk/phase3/includes/api/ApiFormatXml.php 2011-11-03 23:14:58 UTC (rev
101912)
@@ -38,7 +38,6 @@
private $mRootElemName = 'api';
public static $namespace = 'http://www.mediawiki.org/xml/api/';
private $mDoubleQuote = false;
- private $mIncludeNamespace = false;
private $mXslt = null;
public function __construct( $main, $format ) {
@@ -60,19 +59,19 @@
public function execute() {
$params = $this->extractRequestParams();
$this->mDoubleQuote = $params['xmldoublequote'];
- $this->mIncludeNamespace = $params['includexmlnamespace'];
$this->mXslt = $params['xslt'];
$this->printText( '<?xml version="1.0"?>' );
if ( !is_null( $this->mXslt ) ) {
$this->addXslt();
}
- if ( $this->mIncludeNamespace ) {
- $data = array( 'xmlns' => self::$namespace ) +
$this->getResultData();
- } else {
- $data = $this->getResultData();
- }
+ // If the result data already contains an 'xmlns' namespace
added
+ // for custom XML output types, it will override the one for the
+ // generic API results.
+ // This allows API output of other XML types like Atom, RSS,
RSD.
+ $data = $this->getResultData() + array( 'xmlns' =>
self::$namespace );
+
$this->printText(
self::recXmlPrint( $this->mRootElemName,
$data,
@@ -209,7 +208,6 @@
return array(
'xmldoublequote' => false,
'xslt' => null,
- 'includexmlnamespace' => false,
);
}
@@ -217,7 +215,6 @@
return array(
'xmldoublequote' => 'If specified, double quotes all
attributes and content',
'xslt' => 'If specified, adds <xslt> as stylesheet',
- 'includexmlnamespace' => 'If specified, adds an XML
namespace'
);
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs