API15

JSimpleXML/loadFile: Difference between revisions

From Joomla! Documentation

Doxiki (talk | contribs)
New page: ===Description=== Interprets an XML file into an object <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>...
 
m preparing for archive only
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:


<span class="editsection" style="font-size:76%;">
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JSimpleXML/loadFile|Edit Descripton]]<nowiki>]</nowiki>
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
</span>


{{Description:JSimpleXML/loadFile}}
<! removed transcluded page call, red link never existed >


===Syntax===
===Syntax===
Line 58: Line 58:


<span class="editsection" style="font-size:76%;">
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JSimpleXML/loadFile|Edit See Also]]<nowiki>]</nowiki>
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
</span>
{{SeeAlso:JSimpleXML/loadFile}}
<! removed transcluded page call, red link never existed >


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=loadFile
  category=loadFile
  category=JSimpleXML
  category=JSimpleXML
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*
  format= ,,,
  format= ,,,
</dpl>
</dpl>
[[Category:Archived pages API15]]

Latest revision as of 01:08, 25 March 2017

Description

Interprets an XML file into an object

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

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;
        }
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

Code Examples