API16:JSimpleXML/loadFile
From Joomla! Documentation
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.
Contents |
Description
Interprets an XML file into an object
Description:JSimpleXML/loadFile
Syntax
loadFile($path, $classname=null)
| Parameter Name | Default Value | Description |
|---|---|---|
| $path | Path to xml file containing a well-formed XML document | |
| $classname | null | currently ignored |
Returns
boolean True if successful, false if file empty
Defined in
libraries/joomla/utilities/simplexml.php
Importing
jimport( 'joomla.utilities.simplexml' );
Source Body
function loadFile($path, $classname = null) { //Check to see of the path exists if (!file_exists($path)) { return false; } //Get the XML document loaded into a variable $xml = trim(file_get_contents($path)); if ($xml == '') { return false; } else { $this->_parse($xml); return true; } }
[Edit See Also] SeeAlso:JSimpleXML/loadFile
Examples
<CodeExamplesForm />
