From: Bryan Tong Minh Date: Thu, 6 Oct 2011 20:11:44 +0000 (+0000) Subject: (bug 24781) The API will include an XML namespace if the includexmlnamespace paramete... X-Git-Tag: 1.31.0-rc.0~27222 X-Git-Url: http://git.cyclocoop.org/%27-%20%20.%20url_absolue%28find_in_path%28%27spip_style.css%27%29%29%20%20%20.%20url_absolue%28find_in_path%28%27prive/spip_style.css%27%29%29%20.%20%27?a=commitdiff_plain;h=504d37d6fcd29fc1535bbd9de8f08d868cdcb4f4;p=lhc%2Fweb%2Fwiklou.git (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. --- diff --git a/RELEASE-NOTES-1.18 b/RELEASE-NOTES-1.18 index a9df0f9a81..2bf1051b56 100644 --- a/RELEASE-NOTES-1.18 +++ b/RELEASE-NOTES-1.18 @@ -608,6 +608,8 @@ production. * (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 === diff --git a/includes/api/ApiFormatXml.php b/includes/api/ApiFormatXml.php index d76224b92e..06bd9f3362 100644 --- a/includes/api/ApiFormatXml.php +++ b/includes/api/ApiFormatXml.php @@ -38,6 +38,7 @@ class ApiFormatXml extends ApiFormatBase { 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 @@ class ApiFormatXml extends ApiFormatBase { public function execute() { $params = $this->extractRequestParams(); $this->mDoubleQuote = $params['xmldoublequote']; + $this->mIncludeNamespace = $params['includexmlnamespace']; $this->mXslt = $params['xslt']; $this->printText( '' ); 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 @@ class ApiFormatXml extends ApiFormatBase { return array( 'xmldoublequote' => false, 'xslt' => null, + 'includexmlnamespace' => false, ); } @@ -208,6 +217,7 @@ class ApiFormatXml extends ApiFormatBase { return array( 'xmldoublequote' => 'If specified, double quotes all attributes and content', 'xslt' => 'If specified, adds as stylesheet', + 'includexmlnamespace' => 'If specified, adds an XML namespace' ); }