PHP SimpleXML Functions

PHP SimpleXML Introduction

SimpleXML functions allow you to convert XML into 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

SimpleXML function is a core part 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 SimpleXML element. 5
addChild() Add a child element to SimpleXML element. 5
asXML() Get XML string from SimpleXML element. 5
attributes() Get attributes of SimpleXML element. 5
children() Get the children of specified node. 5
getDocNamespaces() Get the namespace of XML document. 5
getName() Get the name of SimpleXML element. 5
getNamespaces() Get namespace from XML data. 5
registerXPathNamespace() Create namespace context for the next XPath query. 5
simplexml_import_dom() Get SimpleXMLElement object from DOM node. 5
simplexml_load_file() Get SimpleXMLElement object from XML document. 5
simplexml_load_string() Get SimpleXMLElement object from XML string. 5
xpath() Run XPath queries on XML data. 5

PHP SimpleXML Constants

None.