This function will convert the well-formed XML document in the file
specified by filename to an object
of class SimpleXMLElement. If any errors occur during file
access or interpretation, the function returns FALSE.
You may use the optional class_name parameter so
that simplexml_load_file() will return an object of
the specified class. That class should extend the
SimpleXMLElement class.
Since PHP 5.1.0 and Libxml 2.6.0, you may also use the
options parameter to specify additional Libxml parameters.
Example 1. Interpret an XML document
<?php // The file test.xml contains an XML document with a root element // and at least an element /[root]/title.
if (file_exists('test.xml')) { $xml = simplexml_load_file('test.xml');
var_dump($xml); } else { exit('Failed to open test.xml.'); } ?>
This script will display, on success:
SimpleXMLElement Object
(
[title] => Example Title
...
)
At this point, you can go about using $xml->title
and any other elements.
simplexml load file php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online
Php simplexml load file syntax tutorial
php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.