<?php
-
/**
- * Created on Sep 19, 2006
*
- * API for MediaWiki 1.8+
+ *
+ * Created on Sep 19, 2006
*
* Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
*
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
*/
if ( !defined( 'MEDIAWIKI' ) ) {
}
/**
+ * API XML output formatter
* @ingroup API
*/
class ApiFormatXml extends ApiFormatBase {
private $mRootElemName = 'api';
+ public static $namespace = 'http://www.mediawiki.org/xml/api/';
private $mDoubleQuote = false;
private $mXslt = null;
}
$this->printText(
self::recXmlPrint( $this->mRootElemName,
- $this->getResultData(),
+ array( 'xmlns' => self::$namespace ) + $this->getResultData(),
$this->getIsHtml() ? - 2 : null,
$this->mDoubleQuote
)
*
* If neither key is found, all keys become element names, and values become element content.
* The method is recursive, so the same rules apply to any sub-arrays.
+ *
+ * @param $elemName
+ * @param $elemValue
+ * @param $indent
+ * @param $doublequote bool
+ *
+ * @return string
*/
public static function recXmlPrint( $elemName, $elemValue, $indent, $doublequote = false ) {
$retval = '';
$retval .= self::recXmlPrint( $subElemId, $subElemValue, $indent );
}
- foreach ( $indElements as $subElemId => & $subElemValue ) {
+ foreach ( $indElements as &$subElemValue ) {
$retval .= self::recXmlPrint( $subElemIndName, $subElemValue, $indent );
}
public function getParamDescription() {
return array(
- 'xmldoublequote' => 'If specified, double quotes all attributes and content.',
+ 'xmldoublequote' => 'If specified, double quotes all attributes and content',
'xslt' => 'If specified, adds <xslt> as stylesheet',
);
}