Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/koc/xml-iterator
https://github.com/koc/xml-iterator
Last synced: about 5 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/koc/xml-iterator
- Owner: Koc
- License: mit
- Created: 2018-09-16T20:33:37.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-11-03T20:03:26.000Z (about 4 years ago)
- Last Synced: 2024-11-08T21:19:33.821Z (11 days ago)
- Language: PHP
- Size: 16.6 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# XmlIterator
Fast and memory efficient XML iterator based on XmlReader.
[![Build Status](https://travis-ci.org/Koc/xml-iterator.svg?branch=master)](https://travis-ci.org/Koc/xml-iterator)
## Installation
Run
```
$ composer require brouzie/xml-iterator
```## Usage
```php
rewind();
} catch (\Brouzie\XmlIterator\Exception\FileParseError $error) {
var_dump($error->getMessage(), $error->getContext()->getLine(), $error->getContext()->getColumn());
}while ($iterator->hasNextItem()) {
try {
$item = $iterator->getNextItem();
var_dump(
$item->getXml(), // \SimpleXmlElement
$item->getContext(),
$item->getLine(),
$item->getColumn()
);
} catch (\Brouzie\XmlIterator\Exception\LineParseError $error) {
if ($error->getContext()) {
var_dump($error->getMessage(), $error->getContext()->getLine(), $error->getContext()->getColumn());
} else {
var_dump($error->getMessage());
}
}
}```