xref: /PHP-8.2/ext/zip/examples/odt.php (revision 58b17906)
1<?php
2
3$reader = new XMLReader();
4
5$reader->open('zip://' . dirname(__FILE__) . '/test.odt#meta.xml');
6$odt_meta = array();
7while ($reader->read()) {
8    if ($reader->nodeType == XMLREADER::ELEMENT) {
9        $elm = $reader->name;
10    } else {
11        if ($reader->nodeType == XMLREADER::END_ELEMENT && $reader->name == 'office:meta') {
12            break;
13        }
14        if (!trim($reader->value)) {
15            continue;
16        }
17        $odt_meta[$elm] = $reader->value;
18    }
19}
20print_r($odt_meta);
21