PHP SimpleXML Functions

PHP SimpleXML Introduction

The SimpleXML function allows you to convert XML to an object.

This object can be handled through ordinary attribute selectors or array iterators, just like any other object.

Some of these functions require the latest PHP version.

Installation

The SimpleXML function is a core component of PHP. These functions can be used without installation.

PHP SimpleXML Functions

PHP:Indicates the earliest PHP version that supports this function.

Function Description PHP
__construct() Create a new SimpleXMLElement object. 5
addAttribute() Add an attribute to a SimpleXML element. 5
addChild() Add a child element to a SimpleXML element. 5
asXML() Get an XML string from a SimpleXML element. 5
attributes() Get the attributes of a SimpleXML element. 5
children() Get the children of a specified node. 5
getDocNamespaces() Get the namespace of an XML document. 5
getName() Get the name of a SimpleXML element. 5
getNamespaces() Get namespaces from XML data. 5
registerXPathNamespace() Create a namespace context for the next XPath query. 5
simplexml_import_dom() Get a SimpleXMLElement object from a DOM node. 5
simplexml_load_file() Get a SimpleXMLElement object from an XML document. 5
simplexml_load_string() Get a SimpleXMLElement object from an XML string. 5
xpath() Run XPath queries on XML data. 5

PHP SimpleXML Constants

None.