r99135 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99134‎ | r99135 | r99136 >
Date:20:11, 6 October 2011
Author:btongminh
Status:ok
Tags:
Comment:
(bug 24781) The API will include an XML namespace if the includexmlnamespace parameter is set.
Partial revert of r88007, which adds the namespace unconditionally, since it breaks stuff as per the bug discussion.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.18 (modified) (history)
  • /trunk/phase3/includes/api/ApiFormatXml.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.18
@@ -608,6 +608,8 @@
609609 * (bug 28817) Add reference help page link to API Modules
610610 * (bug 29935) Improve formatting of examples in ApiParamInfo
611611 * (bug 29938) list=users&usprop=rights shows rights the user doesn't have
 612+* (bug 24781) The API will include an XML namespace if the includexmlnamespace
 613+ parameter is set.
612614
613615 === Languages updated in 1.18 ===
614616
Index: trunk/phase3/includes/api/ApiFormatXml.php
@@ -38,6 +38,7 @@
3939 private $mRootElemName = 'api';
4040 public static $namespace = 'http://www.mediawiki.org/xml/api/';
4141 private $mDoubleQuote = false;
 42+ private $mIncludeNamespace = false;
4243 private $mXslt = null;
4344
4445 public function __construct( $main, $format ) {
@@ -59,15 +60,22 @@
6061 public function execute() {
6162 $params = $this->extractRequestParams();
6263 $this->mDoubleQuote = $params['xmldoublequote'];
 64+ $this->mIncludeNamespace = $params['includexmlnamespace'];
6365 $this->mXslt = $params['xslt'];
6466
6567 $this->printText( '<?xml version="1.0"?>' );
6668 if ( !is_null( $this->mXslt ) ) {
6769 $this->addXslt();
6870 }
 71+ if ( $this->mIncludeNamespace ) {
 72+ $data = array( 'xmlns' => self::$namespace ) + $this->getResultData();
 73+ } else {
 74+ $data = $this->getResultData();
 75+ }
 76+
6977 $this->printText(
7078 self::recXmlPrint( $this->mRootElemName,
71 - array( 'xmlns' => self::$namespace ) + $this->getResultData(),
 79+ $data,
7280 $this->getIsHtml() ? - 2 : null,
7381 $this->mDoubleQuote
7482 )
@@ -201,6 +209,7 @@
202210 return array(
203211 'xmldoublequote' => false,
204212 'xslt' => null,
 213+ 'includexmlnamespace' => false,
205214 );
206215 }
207216
@@ -208,6 +217,7 @@
209218 return array(
210219 'xmldoublequote' => 'If specified, double quotes all attributes and content',
211220 'xslt' => 'If specified, adds <xslt> as stylesheet',
 221+ 'includexmlnamespace' => 'If specified, adds an XML namespace'
212222 );
213223 }
214224

Follow-up revisions

RevisionCommit summaryAuthorDate
r991371.18wmf1: MFT r99135catrope20:42, 6 October 2011
r99415MFT r99135 -- partially undoes breakage from r88007...brion18:34, 10 October 2011
r100379REL1_18 MFT r99135, r99136, r99138, r99154, r99172, r99250, r99252, r99254, r...reedy21:22, 20 October 2011
r101912* (bug 31878, bug 31542) Fix XML namespace output in API; removed now-unneede...brion23:14, 3 November 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r88007(bug 24781) Define XML namespace for API output. Also created the referenced ...catrope16:34, 13 May 2011

Status & tagging log