Closed ronnievisser closed 7 years ago
Hi!
Absolutely, require both:
composer require prewk/xml-string-streamer
composer require prewk/xml-string-streamer-guzzle
And then use them like this:
use Prewk\XmlStringStreamer;
use Prewk\XmlStringStreamer\Stream;
use Prewk\XmlStringStreamer\Parser;
$url = "http://example.com/really-large-xml-file.xml";
$CHUNK_SIZE = 1024;
$stream = new Stream\Guzzle($url, $CHUNK_SIZE);
$parser = new Parser\UniqueNode(array(
"uniqueNode" => "TheNodeToCapture"
));
$streamer = new XmlStringStreamer($parser, $stream);
while ($node = $streamer->getNode()) {
// ...
}
I think my README is a bit off regarding the constructor arguments for the parsers, unfortunately. I'll fix it!
Also, the separation of the repos doesn't make much sense anymore, considering the PHP version market shares etc. If I'd re-done it today, I would've put it all in one repo.
ok thanks for the info
Hi,
Can we use the UniqueNode parser together with the guzzle stream reader repository?
thanks