PHP Velho Oeste 2024

XMLReader::XML

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

XMLReader::XMLEstablece el contenido del XML a analizar

Descripción

public static XMLReader::XML(string $source, ?string $encoding = null, int $flags = 0): bool|XMLReader

Establece el contenido del XML a analizar.

Parámetros

source

La cadena que contiene el XML a ser analizado.

encoding

La codificación del documento o null.

flags

Una mascara bit de la constante LIBXML_*.

Valores devueltos

Devuelve true en caso de éxito o false en caso de error. Si es llamado de forma estática, devuelve un XMLReader o false en caso de error.

Errores/Excepciones

This method may be called statically, but prior to PHP 8.0.0, will issue an E_DEPRECATED error in this case.

Historial de cambios

Versión Descripción
8.0.0 XMLReader::XML() is now declared as static method, but can still be called on an XMLReader instance.

Ver también

add a note add a note

User Contributed Notes 1 note

up
0
dyktus
6 years ago
If you use statically
<?php
$xmlReader
= XMLReader::xml($xmlString);
?>
You probably can receive such notice:

Non-static method XMLReader::XML() should not be called statically

Solution for this notice can be found below:
<?php
$xmlReader
= new XMLReader();
$xmlReader->xml($xmlString);
?>
To Top