PHP SimpleXML Introduction
The SimpleXML functions lets you convert XML to an object.
This object can be processed, like any other object, with normal property selectors and array iterators.
Some of these functions requires the newest PHP build.
Installation
The SimpleXML functions are part of the PHP core. There is no installation needed to use these functions.
PHP SimpleXML Functions
PHP: indicates the earliest version of PHP that supports the function.
Function | Description | PHP |
__construct() | Creates a new SimpleXMLElement object | 5 |
addAttribute() | Adds an attribute to the SimpleXML element | 5 |
addChild() | Adds a child element the SimpleXML element | 5 |
asXML() | Gets an XML string from a SimpleXML element | 5 |
attributes() | Gets a SimpleXML element’s attributes | 5 |
children() | Gets the children of a specified node | 5 |
getDocNamespaces() | Gets the namespaces of an XML document | 5 |
getName() | Gets the name of a SimpleXML element | 5 |
getNamespaces() | Gets the namespaces from XML data | 5 |
registerXPathNamespace() | Creates a namespace context for the next XPath query | 5 |
simplexml_import_dom() | Gets a SimpleXMLElement object from a DOM node | 5 |
simplexml_load_file() | Gets a SimpleXMLElement object from an XML document | 5 |
simplexml_load_string() | Gets a SimpleXMLElement object from an XML string | 5 |
xpath() | Runs an XPath query on XML data | 5 |
PHP SimpleXML Constants
None