user317005
user317005

Reputation:

How do I parse this XML file from Blip.tv?

How do I get blip:picture and blip:embedUrl from the following XML:

<rss xmlns:blip="http://blip.tv/dtd/blip/1.0">
  <channel>
    <item>
      <blip:picture>http://blip.tv/skin/blipnew/placeholder_user.gif</blip:picture>
      <blip:embedUrl type="application/x-shockwave-flash">http://blip.tv/play/gvsIgeevJAI</blip:embedUrl>
    </item
  </channel>
</rss>

The full XML feed is here:

http://blip.tv/rss/3790656

Solution:

$xml = new SimpleXMLElement($result);

$thumbnail = $xml->xpath('channel/item/blip:picture');

$thumbnail = $thumbnail[0];

Upvotes: 0

Views: 283

Answers (2)

redbmk
redbmk

Reputation: 4796

$xml is a SimpleXMLElement, and you can use the xpath function to retrieve your information.

$picture  = $xml->xpath('item/blip:picture');
$embedUrl = $xml->xpath('item/blip:embedUrl');

Upvotes: 1

GolezTrol
GolezTrol

Reputation: 116180

By Reading The Fancy Manual.

[edit, in response to yours]

There is no such thing as custom tags in XML. Or actually, they all are custom elements. There are no fixed tags, unlike in XHTML, which is a special structure, describing HTML-specific elements in an XML structure.

Upvotes: 0

Related Questions