odt.php 452 B

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