Index: trunk/phase3/RELEASE-NOTES-1.18 |
— | — | @@ -608,6 +608,8 @@ |
609 | 609 | * (bug 28817) Add reference help page link to API Modules |
610 | 610 | * (bug 29935) Improve formatting of examples in ApiParamInfo |
611 | 611 | * (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. |
612 | 614 | |
613 | 615 | === Languages updated in 1.18 === |
614 | 616 | |
Index: trunk/phase3/includes/api/ApiFormatXml.php |
— | — | @@ -38,6 +38,7 @@ |
39 | 39 | private $mRootElemName = 'api'; |
40 | 40 | public static $namespace = 'http://www.mediawiki.org/xml/api/'; |
41 | 41 | private $mDoubleQuote = false; |
| 42 | + private $mIncludeNamespace = false; |
42 | 43 | private $mXslt = null; |
43 | 44 | |
44 | 45 | public function __construct( $main, $format ) { |
— | — | @@ -59,15 +60,22 @@ |
60 | 61 | public function execute() { |
61 | 62 | $params = $this->extractRequestParams(); |
62 | 63 | $this->mDoubleQuote = $params['xmldoublequote']; |
| 64 | + $this->mIncludeNamespace = $params['includexmlnamespace']; |
63 | 65 | $this->mXslt = $params['xslt']; |
64 | 66 | |
65 | 67 | $this->printText( '<?xml version="1.0"?>' ); |
66 | 68 | if ( !is_null( $this->mXslt ) ) { |
67 | 69 | $this->addXslt(); |
68 | 70 | } |
| 71 | + if ( $this->mIncludeNamespace ) { |
| 72 | + $data = array( 'xmlns' => self::$namespace ) + $this->getResultData(); |
| 73 | + } else { |
| 74 | + $data = $this->getResultData(); |
| 75 | + } |
| 76 | + |
69 | 77 | $this->printText( |
70 | 78 | self::recXmlPrint( $this->mRootElemName, |
71 | | - array( 'xmlns' => self::$namespace ) + $this->getResultData(), |
| 79 | + $data, |
72 | 80 | $this->getIsHtml() ? - 2 : null, |
73 | 81 | $this->mDoubleQuote |
74 | 82 | ) |
— | — | @@ -201,6 +209,7 @@ |
202 | 210 | return array( |
203 | 211 | 'xmldoublequote' => false, |
204 | 212 | 'xslt' => null, |
| 213 | + 'includexmlnamespace' => false, |
205 | 214 | ); |
206 | 215 | } |
207 | 216 | |
— | — | @@ -208,6 +217,7 @@ |
209 | 218 | return array( |
210 | 219 | 'xmldoublequote' => 'If specified, double quotes all attributes and content', |
211 | 220 | 'xslt' => 'If specified, adds <xslt> as stylesheet', |
| 221 | + 'includexmlnamespace' => 'If specified, adds an XML namespace' |
212 | 222 | ); |
213 | 223 | } |
214 | 224 | |