mapleleaf Posted June 16, 2009 Share Posted June 16, 2009 So my xml starts like this and there are about 10 ARTICLES in it. How do I get the attibutes of ARTICLE like POSTING_DATE? xml: <?xml version="1.0"?> <!DOCTYPE NEWSFEED SYSTEM "http://www.somesite/newsfeed.dtd"> <NEWSFEED> <ARTICLE ID="435655" POSTING_DATE="16-Jun-2009" POSTING_TIME="09:00" ARCHIVE_DATE="05-Jun-2010"> <NEWS_TYPE>News</NEWS_TYPE> PHP <?php $xmlRaw = file_get_contents($filename); $this->load->library('simplexml'); $xmlData = $this->simplexml->xml_parse($xmlRaw); ?> AND my view file in PHP too: <?php foreach($xmlData['ARTICLE'] as $row) { echo $row['ARTICLE'][postING_DATE']; echo '<br>'; echo '<hr>'; } ?> Quote Link to comment 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.