saipkjai Posted October 11, 2007 Share Posted October 11, 2007 hi right now I have the following feed <?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> <entry> <title>Test entry #3</title> <id>http://example.org/article3</id> <updated>2006-10-03T13:14:34Z</updated> <link href="http://example.org/article3" /> <content type="xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml"> <xhtml:div>This is also <xhtml:em>very</xhtml:em> exciting. & </xhtml:div> </content> </entry> <entry> <title>Test entry #4</title> <id>http://example.org/article4</id> <updated>2006-10-03T14:14:34Z</updated> <link href="http://example.org/article4" /> <content type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml"><p>This is also <em>very</em> exciting.</p> <p>Yes, it is.</p></div> </content> </entry> </feed> when I try to parse it using simplexml like the following, only part of the entry 3 element appears, and there is nothing for the entry 4. Am I in the wrong track? how should I fix this problem? foreach ($xml->entry as $entry) { foreach ($entry->content->children("http://www.w3.org/1999/xhtml") as $child){ echo "$child"; } } thx for the help Quote Link to comment https://forums.phpfreaks.com/topic/72809-simplexml-question/ Share on other sites More sharing options...
saipkjai Posted October 12, 2007 Author Share Posted October 12, 2007 forgot to attach the result entry 3 will only have This is also exciting. & which is missing the "very" word and the entry 4 will not have anything appear.. Quote Link to comment https://forums.phpfreaks.com/topic/72809-simplexml-question/#findComment-367670 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.