Skip to content

Commit 01220cd

Browse files
committed
Update readme.md
1 parent b0baee4 commit 01220cd

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

readme.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@ Wrapper XMLReader(http://php.net/manual/ru/book.xmlreader.php) class, for simple
44

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

7-
Usage example: http://github.com/dkrnl/SimpleXMLReader/blob/master/examples/example1.php
7+
Usage example 1:
8+
```php
9+
$reader = new SimpleXMLReader;
10+
$reader->open("big.xml");
11+
$reader->registerCallback("by-node-name", function($reader) {
12+
$element = $reader->expandSimpleXml(); // copy of the current node as a SimpleXMLElement object
13+
$attributes = $element->attributes(); // read element attributes
14+
/* ... */
15+
});
16+
$reader->registerCallback("/by/xpath/query", function($reader) {
17+
$element = $reader->expandSimpleXml(); // copy of the current node as a SimpleXMLElement object
18+
$attributes = $element->attributes(); // read element attributes
19+
/* ... */
20+
});
21+
$reader->parse();
22+
$reader->close();
23+
24+
```
25+
Usage example 2: http://github.com/dkrnl/SimpleXMLReader/blob/master/examples/example1.php
826

927
License: Public Domain

0 commit comments

Comments
 (0)