Wrapped XMLReader class, for simple SAX-reading of huge xml.
Switch branches/tags
Nothing to show
Clone or download
dkrnl Update composer.json
Reading composer.json of dkrnl/simplexmlreader (master)
Skipped branch master, Invalid package information: 
License "Public Domain" is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.
If the software is closed-source, you may use "proprietary" as license.
Latest commit 937ffa1 Feb 14, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples add xpath query support Nov 11, 2013
library Add 'preserveWhiteSpace' boolean flag Aug 18, 2016
autoload.php Update autoload.php May 12, 2015
composer.json Update composer.json Feb 14, 2018
readme.md Update readme.md Mar 18, 2016

readme.md

Simple XML Reader

Wrapper XMLReader(http://php.net/manual/ru/book.xmlreader.php) class, for simple SAX-reading(and simple XPath-queries) of huge(testing over 1G file) xml.

Minimum the memory usage of other xml libraries(SimpleXML, DOMXML).

Usage example 1:

$reader = new SimpleXMLReader;
$reader->open("big.xml");
$reader->registerCallback("by-node-name", function($reader) {
    $element = $reader->expandSimpleXml(); // copy of the current node as a SimpleXMLElement object
    $attributes = $element->attributes(); // read element attributes
    /* ... */
});
$reader->registerCallback("/by/xpath/query", function($reader) {
    $element = $reader->expandDomDocument(); // copy of the current node as a DOMNode object
    $attributes = $element->attributes(); // read element attributes
    /* ... */
});
$reader->parse();
$reader->close();

Usage example 2: http://github.com/dkrnl/SimpleXMLReader/blob/master/examples/example1.php

License: Public Domain