br3nn4n Posted August 11, 2009 Share Posted August 11, 2009 Hey guys, I have an XML doc that needs parsing: <ISBNdb server_time="2009-08-11T22:49:51Z"> <AuthorList total_results="17" page_size="10" page_number="1" shown_results="10"> <AuthorData person_id="rowling_jk"> <Name>Rowling JK</Name> </AuthorData> <AuthorData person_id="rowling_j_k_a01"> <Name>Rowling J K</Name> </AuthorData> <AuthorData person_id="cathy_rowling"> <Name>Cathy Rowling</Name> </AuthorData> <AuthorData person_id="jessica_rowling"> <Name>Jessica Rowling</Name> </AuthorData> <AuthorData person_id="jk_rowling"> <Name>JK Rowling</Name> </AuthorData> <AuthorData person_id="joanne_k_rowling"> <Name>Joanne K. Rowling</Name> </AuthorData> <AuthorData person_id="marije_rowling"> <Name>Marije Rowling</Name> </AuthorData> <AuthorData person_id="marjie_rowling"> <Name>Marjie Rowling</Name> </AuthorData> <AuthorData person_id="mary_c_rowling"> <Name>Mary C. Rowling</Name> </AuthorData> <AuthorData person_id="marye_rowling"> <Name>Marye Rowling</Name> </AuthorData> </AuthorList> </ISBNdb> I need the person_id value of the AuthorData element really, and maybe the name element's content too. I'm using PHP 5 so SimpleXML is available. For the name element I'm thinking of doing a foreach: foreach($xml->name as $name) { echo $name; } But to get the person_id attribute...I'm clueless. How do I access that? Thanks!! Link to comment https://forums.phpfreaks.com/topic/169839-how-is-this-super-simple-xml-document-parsed/ Share on other sites More sharing options...
br3nn4n Posted August 12, 2009 Author Share Posted August 12, 2009 Any ideas? Link to comment https://forums.phpfreaks.com/topic/169839-how-is-this-super-simple-xml-document-parsed/#findComment-896291 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.