simple xml namespace issue

I am trying to use php to pull out some information from an xml file that is included in an ebook. I am able to get most of the information out of the xml easily with simple xml, but have sofar been unable to get anywhere with the series and series_index. Any help would be appreciated.

xml file:

<?xml version="1.0" encoding="UTF-8"?> <package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="uuid_id"> <metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:opf="http://www.idpf.org/2007/opf" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:calibre="http://calibre.kovidgoyal.net/2009/metadata" xmlns:dc="http://purl.org/dc/elements/1.1/"> <dc:creator opf:role="aut" opf:file-as="Adams, Douglas">Douglas Adams</dc:creator> <dc:publisher>Random House, Inc.</dc:publisher> <meta name="calibre:series_index" content="1.0"/> <meta name="calibre:title_sort" content="Hitchhiker's Guide to the Galaxy, The"/> <dc:description>SUMMARY: Don't panic! You're not timetripping! It's the tenth anniversary of the publication of Douglas Adams's zany, best-selling novel, and to celebrate Harmony is reissuing a special edition of this cult classic!By now the story is legendary. Arthur Dent, mild-mannered, out-to-lunch earth-ling, is plucked from his planet by his friend Ford Prefect just seconds before it was demolished to make way for a hyper-space bypass. Ford, posing as an out-of-work actor, is a researcher for the revised edition of The Hitchhiker's Guide to the Galaxy. Together the gruesome twosome begin their now-famous inter-galactic journey through time, space and best-sellerdom.For Hitchhiker fanatics (you know who you are!) who've read the books, seen the television program, and listened to the radio show, as well as newcomers to Douglas Adams's unique universe -- remember -- don't panic, don't forget to bring a towel, and don't forget to celebrate The Hitchhiker's Guide to the Galaxy's tenth anniversary by wearing your bathrobe.From the Hardcover edition.</dc:description> <meta name="calibre:timestamp" content="2010-06-03T17:06:24+00:00"/> <dc:title>The Hitchhiker's Guide to the Galaxy</dc:title> <meta name="cover" content="cover"/> <dc:date>1997-06-22T07:00:00+00:00</dc:date> <meta name="calibre:series" content="The Hitchhiker's Guide to the Galaxy"/> <dc:contributor opf:role="bkp">calibre (0.8.61) [http://calibre-ebook.com]</dc:contributor> <dc:identifier opf:scheme="ISBN">9780345418913</dc:identifier> <dc:identifier id="uuid_id" opf:scheme="uuid">36515eb7-1a25-4469-b55e-0042d45ca508</dc:identifier> <meta name="calibre:rating" content="0.0"/> <dc:subject>Science-Fiction</dc:subject>

This is the simple xml I am using to get most information with the dc namespace - but cannot get any from the calibre information. I only need the series and series_index “content” information.

[php]
$author = $package->metadata->children(‘dc’, true)->creator;
$title = $package->metadata->children(‘dc’, true)->title;[/php]

Have a look at this thread and their method of reading XML

http://www.phphelp.com/forum/index.php?topic=17339.msg57928#msg57928

Am looking into it now - the scary/funny part is that i may not need to do the xml at all - thanks for the help!

Sponsor our Newsletter | Privacy Policy | Terms of Service