simplexml_load_file
Interprets an XML file into an object
&reftitle.description;
SimpleXMLElementfalsesimplexml_load_file
stringfilename
stringnullclass_nameSimpleXMLElement::class
intoptions0
stringnamespace_or_prefix""
boolis_prefix&false;
Convert the well-formed XML document in the given file to an object.
&reftitle.parameters;
filename
Path to the XML file
class_name
You may use this optional parameter so that
simplexml_load_file will return an object of
the specified class. That class should extend the
SimpleXMLElement class.
options
&dom.parameter.options;
namespace_or_prefix
Namespace prefix or URI.
is_prefix
&true; if namespace_or_prefix is a prefix, &false; if it's a URI;
defaults to &false;.
&reftitle.returnvalues;
Returns an object of class SimpleXMLElement with
properties containing the data held within the XML document,&return.falseforfailure;.
&return.falseproblem;
&reftitle.errors;
Produces an E_WARNING error message for each error
found in the XML data.
Use libxml_use_internal_errors to suppress all XML
errors, and libxml_get_errors to iterate over them
afterwards.
&reftitle.examples;
Interpret an XML document
]]>
This script will display, on success:
Array
...
)
]]>
At this point, you can go about using $xml->title
and any other elements.
&reftitle.seealso;
simplexml_load_string
SimpleXMLElement::__construct
libxml_use_internal_errors
libxml_set_streams_context