http://www.mediawiki.org/wiki/Special:Code/MediaWiki/99135
Revision: 99135 Author: btongminh Date: 2011-10-06 20:11:44 +0000 (Thu, 06 Oct 2011) Log Message: ----------- (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 trunk/phase3/includes/api/ApiFormatXml.php Modified: trunk/phase3/RELEASE-NOTES-1.18 =================================================================== --- trunk/phase3/RELEASE-NOTES-1.18 2011-10-06 20:04:35 UTC (rev 99134) +++ trunk/phase3/RELEASE-NOTES-1.18 2011-10-06 20:11:44 UTC (rev 99135) @@ -608,6 +608,8 @@ * (bug 28817) Add reference help page link to API Modules * (bug 29935) Improve formatting of examples in ApiParamInfo * (bug 29938) list=users&usprop=rights shows rights the user doesn't have +* (bug 24781) The API will include an XML namespace if the includexmlnamespace + parameter is set. === Languages updated in 1.18 === Modified: trunk/phase3/includes/api/ApiFormatXml.php =================================================================== --- trunk/phase3/includes/api/ApiFormatXml.php 2011-10-06 20:04:35 UTC (rev 99134) +++ trunk/phase3/includes/api/ApiFormatXml.php 2011-10-06 20:11:44 UTC (rev 99135) @@ -38,6 +38,7 @@ 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 ) { @@ -59,15 +60,22 @@ 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(); + } + $this->printText( self::recXmlPrint( $this->mRootElemName, - array( 'xmlns' => self::$namespace ) + $this->getResultData(), + $data, $this->getIsHtml() ? - 2 : null, $this->mDoubleQuote ) @@ -201,6 +209,7 @@ return array( 'xmldoublequote' => false, 'xslt' => null, + 'includexmlnamespace' => false, ); } @@ -208,6 +217,7 @@ 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 MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs