Before you shoot me down, give me a minute. I've looked in SO for the answer - here's the problem
I have an external XML/RDF file which must be parsed with roughly this structure
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://ift.tt/oZyhLL"
xmlns:rss="http://ift.tt/RFqq7V"
xmlns:os="http://ift.tt/LMPdQR"
xmlns:dc="http://ift.tt/mToXri"
xmlns:dcterms="http://ift.tt/qxdZ4f"
xmlns:bibo="http://ift.tt/1s1MdXa">
<rss:channel rdf:about="http://domain.com/feed/">
<rss:link rdf:resource="http://ift.tt/1s1MdXd" />
<rss:title>Search Results</rss:title>
<os:startIndex>0</os:startIndex>
<os:itemsPerPage>10</os:itemsPerPage>
<os:totalResults>13</os:totalResults>
<rss:items rdf:resource="urn:unique-identifier" />
</rss:channel>
<rss:item rdf:about="http://ift.tt/1nZiQE0">
<rss:link>http://ift.tt/1s1MgSB;
<rss:title>Book Title</rss:title>
<rss:description>Random Book Description</rss:description>
<dc:creator>First Name Last Name, 1901</dc:creator>
<dcterms:language rdf:datatype="http://ift.tt/1nZiPA6">eng</dcterms:language>
<dc:format>Book</dc:format>
<dc:publisher>London : Publisher</dc:publisher>
<dc:date>2009</dc:date>
<bibo:isbn>1234567890</bibo:isbn>
<bibo:eanucc13>1234567890</bibo:eanucc13>
<dcterms:identifier>1234567890</dcterms:identifier>
</rss:item>
</rdf:RDF>
Right so that's the XML file. Here's what I know
- I can loop the feed to get the numbers
Using a
file_get_contents($var)
I get this errorWarning: simplexml_load_file(): I/O warning : failed to load external entity
I can't use
foreach($rss->item as $item)
because the item itself has a colon in place.- I've tried replacing the colons with underscores and the error from #2 arises.
- I've tried a DOM method mentioned somewhere in Stack Overflow.
- I've tried SimpleXML method mentioned on Stack Overflow.
All I want to do is loop the rss:items
and extract the items underneath.
Any help would be genuinely really appreciated as I'm tearing my hair out and I'm out of coffee!
Thanks so much,
Martin
No comments:
Post a Comment