XMLReader::XML

Set the data containing the XML to parse

&reftitle.description; public static `XMLReader` `XMLReader::XML` `string` `source` ``string``null```encoding`&null; `int` `flags` 0 public `bool` `XMLReader::XML` `string` `source` ``string``null```encoding`&null; `int` `flags` 0

Set the data containing the XML to parse.

&reftitle.parameters;

`source`

- String containing the XML to be parsed.

`encoding`

- The document encoding or &null;.

`flags`

- A bitmask of the LIBXML_* constants.

&reftitle.returnvalues;

&return.success; If called statically, returns an `XMLReader`&return.falseforfailure;.

&reftitle.errors;

- Passing an invalid `encoding` will throw a ValueError.

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

&reftitle.changelog;

&Version; | &Description;
8.4.0 | Passing an invalid `encoding` will now throw a ValueError.
8.0.0 | `XMLReader::XML` is now declared as static method, but can still be called on an `XMLReader` instance.

&reftitle.seealso;

- `XMLReader::open`
- `XMLReader::close`