Actions

API16

JUpdate/loadFromXML

From Joomla! Documentation

< API16:JUpdate
Revision as of 17:43, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

[Edit Descripton]

Description:JUpdate/loadFromXML

Contents

Syntax

loadFromXML($url)
Parameter Name Default Value Description
$url

Defined in

libraries/joomla/updater/update.php

Importing

jimport( 'joomla.updater.update' );

Source Body

public function loadFromXML($url)
{
        if (!($fp = @fopen($url, "r")))
        {
                // TODO: Add a 'mark bad' setting here somehow
                JError::raiseWarning('101', JText::_('Update') .'::'. JText::_('Extension') .': '. JText::_('Could not open').' '. $url);
                return false;
        }
 
        $this->xml_parser = xml_parser_create('');
        xml_set_object($this->xml_parser, $this);
        xml_set_element_handler($this->xml_parser, '_startElement', '_endElement');
        xml_set_character_data_handler($this->xml_parser, '_characterData');
 
        while ($data = fread($fp, 8192))
        {
                if (!xml_parse($this->xml_parser, $data, feof($fp)))
                {
                        die(sprintf("XML error: %s at line %d",
                                                xml_error_string(xml_get_error_code($this->xml_parser)),
                                                xml_get_current_line_number($this->xml_parser)));
                }
        }
        xml_parser_free($this->xml_parser);
        return true;
}

[Edit See Also] SeeAlso:JUpdate/loadFromXML

Examples

<CodeExamplesForm />