Jump to content

jrw4

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

About jrw4

  • Birthday 08/23/1988

Contact Methods

  • Website URL
    http://www.sfurowing.com

Profile Information

  • Gender
    Male
  • Location
    Vancouver Canada

jrw4's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Alright thanks. So it looks like I will have to hand parse the content field then.
  2. If I try just echoing $child->content; nothing gets outputted for those tags.
  3. What am I trying to do? I am trying to display each content value for each entry in an atom feed. echoing $xml->entry->content is fine and dandy if the attribute type of the content is "text" or "html". If it is xhtml then I am running into a problem. If I have an item like this in the feed: and I echo $xml->entry->content or $xml->entry->content->asXML() it will not appear properly. Currently I am getting something like: I am trying to figure out how to get it to appear as: There must be an built in way in SimpleXML to do this instead of having me to do it by hand. This is what I am asking to do. Is how to get an output that looks like the later instead of what I currently have which is the former.
  4. Ok, to my question. I am making a simple atom feed parser. So far here is my code: <?php // read in an xml file $myFile = "an_atom_feed.xml"; $feed = simplexml_load_file($myFile); $xml = $feed->children('http://www.w3.org/2005/Atom'); echo "<h1>".$xml->title . "</h1>\n"; foreach ($xml->entry as $entries) { $child = $entries->children('http://www.w3.org/2005/Atom'); // post title echo "<h3>".$child->title . "</h3>\n"; // post author if (!empty($child->author->name)) echo "<p>Posted by " . $child->author->name . "</p>\n"; // post content if (!empty($child->summary)) echo htmlspecialchars($child->summary) . "<br />\n"; echo $child->content->asXML(); } ?> So far it seems to work fairly well. Obviously I am not dealing with every item in <entry> just the content and title. Now my question comes with, say my feed has the following items in it: I haven't been able to find a tutorial on how to deal with content types like those so I am not sure how to. If you know of tutorials that show me how to deal with stuff like this, that would be very appreciated. If you also know how to deal with it, teaching me would make me très appreciative. Thanks a lot
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.