Hi internals
The XMLReader object only allows a file name in the constructor and the
open() method. While this is OK most of the time, files stored at cloud
services not accessible via an URL must be downloaded first. For big
files (e.g 100MB to 1GB and more), this requires a lot of time and
resources.
If the XMLReader would be able accept a file handle too, we could pass
the handle of a stream to the methods and the XMLReader could process
the XML data on the fly without the need of a local copy.
Is it possible to allow a file handle in the existing methods or is a
new one required due to type or other constraints like implementation
difficulties?
The open() method is implemented here:
Not sure where the constructor is implemented.
Thanks
Norbert
The XMLReader object only allows a file name in the constructor and the
open() method. While this is OK most of the time, files stored at cloud
services not accessible via an URL must be downloaded first. For big
files (e.g 100MB to 1GB and more), this requires a lot of time and
resources.If the XMLReader would be able accept a file handle too, we could pass
the handle of a stream to the methods and the XMLReader could process
the XML data on the fly without the need of a local copy.Is it possible to allow a file handle in the existing methods or is a
new one required due to type or other constraints like implementation
difficulties?The open() method is implemented here:
For clarity, it might be preferable to introduce a new static creation
method for this. The implementation could probably use
xmlReaderForIO()[1], instead of xmlReaderForFile().
Regards,
Christoph
Am 04.12.20 um 13:23 schrieb Christoph M. Becker:
For clarity, it might be preferable to introduce a new static creation
method for this. The implementation could probably use
xmlReaderForIO()[1], instead of xmlReaderForFile().
Wouldn't xmlReaderForFd() be more suitable or is this only for file
handles, not for streams?
What would be a good name for the new method? XMLReader::stream()?
Best,
Norbert
Am 04.12.20 um 13:23 schrieb Christoph M. Becker:
For clarity, it might be preferable to introduce a new static creation
method for this. The implementation could probably use
xmlReaderForIO()[1], instead of xmlReaderForFile().Wouldn't xmlReaderForFd() be more suitable or is this only for file
handles, not for streams?
xmlReaderForFd() is only for file descriptors; PHP streams are more general.
What would be a good name for the new method? XMLReader::stream()?
Maybe XMLReader::createForStream(), but I think the name is secondary;
someone would have to come up at least with a draft implementation first.
Regards,
Christoph