Пример #1
0
 /**
  * Get and parse file content to xml element
  *
  * @param string $xmlfile   Xml file path
  * @param bool   $array     Convert to array or not
  *
  * @return mixed NULL if load or parse file fail, Array if array is true, otherwise JSimpleXML
  */
 public static function getXML($xmlfile, $array = true)
 {
     /*
             $xml = JFactory::getXMLParser('Simple');
             if ($xml->loadFile($xmlfile)) {
                 if ($array)
                     return T3Common::xmltoarray($xml->document);
                 return $xml->document;
             }
             return null;
     */
     //$xml = JFactory::getXML ($xmlfile);
     if (!class_exists('JSimpleXML')) {
         t3import('core.joomla.simplexml');
     }
     $xml = new JSimpleXML();
     if ($xml->loadFile($xmlfile)) {
         if ($array) {
             return T3Common::xmltoarray($xml->document);
         }
         return $xml->document;
     }
     return null;
 }
Пример #2
0
 function getXML($xmlfile, $array = true)
 {
     $xml =& JFactory::getXMLParser('Simple');
     if ($xml->loadFile($xmlfile)) {
         if ($array) {
             return T3Common::xmltoarray($xml->document);
         }
         return $xml->document;
     }
     return null;
 }