Creates a new SimpleXMLElement
object.
Access
final public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Required |
A well-formed XML string or the path or URL to an XML document if |
|
|
Optional |
Optionally used to specify |
|
|
Optional |
By default, |
|
|
Optional |
Namespace prefix or URI. |
|
|
Optional |
|
Examples
Create a SimpleXMLElement object
include 'example.php'; $sxe = new SimpleXMLElement($xmlstr); echo $sxe->movie[0]->title;Result:
PHP: Behind the Parser
Create a SimpleXMLElement object from a URL
$sxe = new SimpleXMLElement('http://example.org/document.xml', NULL, TRUE); echo $sxe->asXML();