Source for file xml.php

Documentation is available at xml.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Platform
  4.  * @subpackage  Document
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE
  8.  */
  9.  
  10. defined('JPATH_PLATFORM'or die;
  11.  
  12. /**
  13.  * DocumentXML class, provides an easy interface to parse and display XML output
  14.  *
  15.  * @package     Joomla.Platform
  16.  * @subpackage  Document
  17.  * @since       11.1
  18.  */
  19. class JDocumentXml extends JDocument
  20. {
  21.     /**
  22.      * Document name
  23.      *
  24.      * @var    string 
  25.      * @since  12.1
  26.      */
  27.     protected $name = 'joomla';
  28.  
  29.     /**
  30.      * Class constructor
  31.      *
  32.      * @param   array  $options  Associative array of options
  33.      *
  34.      * @since   11.1
  35.      */
  36.     public function __construct($options array())
  37.     {
  38.         parent::__construct($options);
  39.  
  40.         // Set mime type
  41.         $this->_mime = 'application/xml';
  42.  
  43.         // Set document type
  44.         $this->_type = 'xml';
  45.     }
  46.  
  47.     /**
  48.      * Render the document.
  49.      *
  50.      * @param   boolean  $cache   If true, cache the output
  51.      * @param   array    $params  Associative array of attributes
  52.      *
  53.      * @return  The rendered data
  54.      *
  55.      * @since  11.1
  56.      */
  57.     public function render($cache false$params array())
  58.     {
  59.         parent::render();
  60.  
  61.         JFactory::getApplication()->setHeader('Content-disposition''inline; filename="' $this->getName('.xml"'true);
  62.  
  63.         return $this->getBuffer();
  64.     }
  65.  
  66.     /**
  67.      * Returns the document name
  68.      *
  69.      * @return  string 
  70.      *
  71.      * @since  11.1
  72.      */
  73.     public function getName()
  74.     {
  75.         return $this->name;
  76.     }
  77.  
  78.     /**
  79.      * Sets the document name
  80.      *
  81.      * @param   string  $name  Document name
  82.      *
  83.      * @return  JDocumentXml instance of $this to allow chaining
  84.      *
  85.      * @since   11.1
  86.      */
  87.     public function setName($name 'joomla')
  88.     {
  89.         $this->name = $name;
  90.  
  91.         return $this;
  92.     }
  93. }

Documentation generated on Tue, 19 Nov 2013 15:18:36 +0100 by phpDocumentor 1.4.3