Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

SimpleXML and PHP

Name: Anonymous 2007-10-18 20:28

Okay, I don't know wtf is going on anymore. I was working on a feed reader and got it working, but as soon as I test a lengthier, real-life feed, it fails. Take for example this feed:

 <entry xml:base='When/200x/2005/11/30/'>
  <title>On “Beyond Java”</title>
  <link href='On-Beyond-Java' />
  <id>http://www.tbray.org/ongoing/When/200x/2005/11/30/On-Beyond-Java</id>;
  <published>2005-11-30T12:00:00-08:00</published>
  <updated>2005-11-30T15:52:41-08:00</updated>
  <category scheme='http://www.tbray.org/ongoing/What/' term='Technology/Java' />
<category scheme='http://www.tbray.org/ongoing/What/' term='Technology' />
<category scheme='http://www.tbray.org/ongoing/What/' term='Java' />
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<p>I just got around to reading Bruce Tate
<a href="http://www.oreilly.com/catalog/beyondjava/">Beyond Java</a>.
</p>
</div>
</content>
</entry>

To get the title I did $xml->entry[$i]->title, which works on this.
But if I try to retrieve the content: $entry->content->asXML(); nothing shows up (which for some weird reason works with the simple version)

The only difference I see between the two are extra tags that don't change the nesting, and single quotes instead of double, which I don't think changes much...

Simple Version:

 <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>

Name: Anonymous 2007-10-18 21:49

Ah, I was missing $entry->content->asXML() in one of my checking statements. Works flawlessly.

Name: Anonymous 2013-08-18 14:42

Thanks for nothing, /prog/.

Name: Anonymous 2013-08-18 14:46

>>3

I agree, the poster should have used a /prog/ approved language such as pythong or pascal.

Name: Anonymous 2013-08-18 14:48

>>5
or LISP

Name: Anonymous 2013-08-18 16:06

>>6
or DooM

Name: Anonymous 2013-08-18 17:33

>>7
Back to /g/ please!.

Name: Anonymous 2013-08-18 17:42

>>8
DooM is a programming language. You modify the monster state machines to simulate circuits and then assemble computers in levels. It accepts the string by triggering a crusher to kill an imp.

Don't change these.
Name: Email:
Entire Thread Thread List