The SimpleXMLElement class

Introduction

(PHP 5, PHP 7)

Represents an element in an XML document.

Class synopsis

SimpleXMLElement implements Traversable {
/* Methods */
final public __construct ( string $data [, int $options = 0 [, bool $data_is_url = false [, string $ns = "" [, bool $is_prefix = false ]]]] )
public addAttribute ( string $name [, string $value [, string $namespace ]] ) : void
public addChild ( string $name [, string $value [, string $namespace ]] ) : SimpleXMLElement
public asXML ([ string $filename ] ) : mixed
public attributes ([ string $ns = null [, bool $is_prefix = false ]] ) : SimpleXMLElement
public children ([ string $ns [, bool $is_prefix = false ]] ) : SimpleXMLElement
public count ( ) : int
public getDocNamespaces ([ bool $recursive = false [, bool $from_root = true ]] ) : array
public getName ( ) : string
public getNamespaces ([ bool $recursive = false ] ) : array
public registerXPathNamespace ( string $prefix , string $ns ) : bool
public __toString ( ) : string
public xpath ( string $path ) : array
}

Table of Contents

© 1997–2020 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/class.simplexmlelement.php