Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Daniel-KM/XMLReaderIterator

 
 

Repository files navigation

Iterators for PHP XMLReader for Ease of Parsing

Change Log:

  • 0.1.13 fixed nested child element parsing (PR #21 on github); fixed deprecation and notices for new php versions; normalized code and docblocks, simplified install.

  • 0.1.12 maintenance release with fixes.

  • 0.1.11 maintenance release with fixes. added XMLReader::CDATA and XMLReader::WHITESPACE node support for XMLWritingIteration. added XMLReaderItertor::skipNextRead() for nested iterations.

  • 0.1.10 maintenance release with fixes.

  • 0.1.9 maintenance release with fixes. added XMLReaderNode::expand().

  • 0.1.8 maintenance release with fixes.

  • 0.1.7 maintenance release with fixes.

  • 0.1.6 maintenance release with fixes. added xml-file-scanner command-line tool example.

  • 0.1.5 maintenance release with tests and new XMLReaderNextIteration to iterate in XMLReader::next() fashion.

  • 0.1.4 maintenance release with fixes.

  • 0.1.3 added XMLSequenceStream, a PHP stream wrapper to read XML from files which are a sequence of XML documents. Works transparently with XMLReader.

  • 0.1.2 added XMLWritingIteration, an iteration to write with XMLWriter from XMLReader.

  • 0.1.0 composer support has been added.

  • 0.0.23 first try of a compatibility layer for PHP installs with a libxml version below version 2.6.20. functions with compatibility checks are XMLReaderNode::readOuterXml() and XMLReaderNode::readString().

  • 0.0.21 moved library into new repository and added XMLReaderAggregate.

  • 0.0.19 added XMLElementXpathFilter, a FilterIterator for XMLReaderIterator by an xpath expression.

    $reader = new XMLReader();
    $reader->open($xmlFile);
    $it = new XMLElementIterator($reader);
    
    $list = new XMLElementXpathFilter(
        $it,
        '//user[@id = "1" or @id = "6"]//message'
    );
    
    foreach ($list as $message) {
        echo " * ",  $message->readString(), "\n";
    }

Usage

It is recommended to use the composer autoloading mechanism.

To use without composer and for backwards compatibility, it is possible just to include the file build/include/xmlreader-iterators.php in any php project.

Checkout the examples folder for more examples.

Stackoverflow Q&A for the XMLReader Iterators

The latest Q&A on top:

Build

To build the single file to use XMLReaderIterator without composer, run:

composer install
php -f build.php

The command sh build.sh can be used too.

About

Iterators for PHP XMLReader for ease of parsing

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • PHP 99.7%
  • Shell 0.3%