XMLReader::fromStream
PHP function
Edit on GitHub ✎
(PHP 8 >= 8.4.0)
Creates an XMLReader from a stream to read from
Description
XMLReader::fromStream(resource $stream, string|null $encoding = null, int $flags = 0, string|null $documentUri = null): static
Creates an XMLReader from a stream to read from.
Parameters
streamThe stream to read the XML from.
encodingThe document encoding or null.
flagsA bitmask of the
LIBXML_*constants.documentUriOptional document base URI.
Return Values
Returns an XMLReader.
Errors/Exceptions
- Passing an invalid
encodingwill throw aValueError. - Passing a resource that is not a stream to
streamwill throw aTypeError.
See Also
XMLReader::fromStringXMLReader::fromUri