The SimpleXMLElement class

Introduction

Represents an element in an XML document.

Class synopsis

SimpleXMLElement
implements Stringable Countable RecursiveIterator
/* Methods */
public __construct(
    string $data,
    int $options = 0,
    bool $dataIsURL = false,
    string $namespaceOrPrefix = "",
    bool $isPrefix = false
)
public void addAttribute(string $qualifiedName, string $value, stringnull $namespace = null)
public SimpleXMLElementnull addChild(string $qualifiedName, stringnull $value = null, stringnull $namespace = null)
public stringbool asXML(stringnull $filename = null)
public SimpleXMLElementnull attributes(stringnull $namespaceOrPrefix = null, bool $isPrefix = false)
public SimpleXMLElementnull children(stringnull $namespaceOrPrefix = null, bool $isPrefix = false)
public int count()
public SimpleXMLElement current()
public arrayfalse getDocNamespaces(bool $recursive = false, bool $fromRoot = true)
public string getName()
public array getNamespaces(bool $recursive = false)
public SimpleXMLElementnull getChildren()
public bool hasChildren()
public string key()
public void next()
public bool registerXPathNamespace(string $prefix, string $namespace)
public void rewind()
public string __toString()
public bool valid()
public arraynullfalse xpath(string $expression)

Changelog

Version Description
8.0.0 SimpleXMLElement implements Stringable, Countable, and RecursiveIterator now.
Table of Contents