LeslieTx Posted November 30, 2019 Share Posted November 30, 2019 Hi... I am working to parse an opf file. I can pull the dc children but am having problems getting it to pull other information from the file. Is there a way to do this? What I am currently doing: $package = simplexml_load_file("$url"); echo $package->metadata->children('dc', true)->creator."<br>"; echo $package->metadata->children('dc', true)->title."<br>"; echo $package->metadata->children('dc', true)->description."<br>"; Is there a way to parse the meta content by name? File structure: <?xml version='1.0' encoding='utf-8'?> <package xmlns="http://www.idpf.org/2007/opf" unique-identifier="uuid_id" version="2.0"> <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf"> <dc:title>The Beginning of the End</dc:title> <dc:creator opf:file-as="Cassidy, Amanda" opf:role="aut">Amanda Cassidy</dc:creator> <dc:description>Working with young children can be a very rewarding job... and extremely frustrating at the...</dc:description> <meta content="Preschool Teachers Anonymous" name="library:series"/> <meta content="1" name="library:series_index"/> </metadata> </package> Quote Link to comment Share on other sites More sharing options...
gizmola Posted November 30, 2019 Share Posted November 30, 2019 Try this: foreach($package->metadata->meta as $meta) { echo "content:{$meta['content']} name: {$meta['name']} <br>"; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.