Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
build/
vendor/
.settings/
.buildpath
.bundle
.cache
.DS_Store
.php_cs.cache
.php-cs-fixer.cache
.phpunit.result.cache
.project
35 changes: 29 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

### 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
Expand Down Expand Up @@ -38,15 +42,15 @@
- `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()`.
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.

~~~php
```php
$reader = new XMLReader();
$reader->open($xmlFile);
$it = new XMLElementIterator($reader);
Expand All @@ -56,15 +60,23 @@
'//user[@id = "1" or @id = "6"]//message'
);

foreach($list as $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 on top (for more examples, checkout the
[`examples`] folder):
The latest Q&A on top:

- [Add Tag Element using XMLReader and SimpleXML or XMLWriter](https://stackoverflow.com/q/69455574/367456)
- [How to distinguish between empty element and null-size string in DOMDocument?](http://stackoverflow.com/a/24109776/367456)
Expand All @@ -73,3 +85,14 @@ the latest on top (for more examples, checkout the
- [Getting XML Attribute with XMLReader and PHP](http://stackoverflow.com/a/15399491/367456)

[`examples`]: https://github.com/hakre/XMLReaderIterator/tree/master/examples

### Build

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

```php
composer install
php -f build.php
```

The command `sh build.sh` can be used too.
Loading