Code (PHP) pasted on 2019-07-17, 22:44 Raw Source
- $content = $filesystem->read($object['path']);
- $xmp_length = $xmp_data_end - $xmp_data_start;
- $document = new DOMDocument();
- $document->loadXml($xmp_data);
- $xpath = new DOMXpath($document);
- /**
- * most likely a bit hackish.. thats how I do get all namespaces...
- */
- foreach ($matches[1] as $key => $alias) {
- // echo "registering $alias for ".$matches[2][$key]."\n";
- $xpath->registerNamespace($alias, $matches[2][$key]);
- }
- $elements = $xpath->query("//*[name()='dc:subject']");
- $tags = [];
- foreach ($elements as $element) {
- $nodes = $element->childNodes;
- foreach ($nodes as $node) {
- $tags[] = $value;
- }
- }
- }
- }