PHP SimpleXML Functions

By | September 29, 2022

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.

FunctionDescriptionPHP
__construct()Creates a new SimpleXMLElement object5
addAttribute()Adds an attribute to the SimpleXML element5
addChild()Adds a child element the SimpleXML element5
asXML()Gets an XML string from a SimpleXML element5
attributes()Gets a SimpleXML element’s attributes5
children()Gets the children of a specified node5
getDocNamespaces()Gets the namespaces of an XML document5
getName()Gets the name of a SimpleXML element5
getNamespaces()Gets the namespaces from XML data5
registerXPathNamespace()Creates a namespace context for the next XPath query5
simplexml_import_dom()Gets a SimpleXMLElement object from a DOM node5
simplexml_load_file()Gets a SimpleXMLElement object from an XML document5
simplexml_load_string()Gets a SimpleXMLElement object from an XML string5
xpath()Runs an XPath query on XML data5

PHP SimpleXML Constants

None

Category: PHP

Leave a Reply

Your email address will not be published. Required fields are marked *