Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

atainex/SimpleXMLReader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

30 Commits

Repository files navigation

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

About

Wrapped XMLReader class, for simple SAX-reading of huge xml.

Resources

Stars

Watchers

Forks

Packages

Contributors

Languages

  • PHP 100.0%

AltStyle によって変換されたページ (->オリジナル) /