dietkinnie Posted April 7, 2009 Share Posted April 7, 2009 Hi Guys, Whisch is the best way to access this data ? <library id="40000003511"> <section>History</sectiont> <book id="9000001846" info="Italy" role="1">History of Rome</Participant> <book id="57" info="England" role="2">History of London</Participant> </library> As you can see there are two books but they both belong to library['id '] = 40000003511. Shall i use a foreach loop to access the book['id'] and book['info'] or is there another method is should use ? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/153065-logic-help/ Share on other sites More sharing options...
MadTechie Posted April 7, 2009 Share Posted April 7, 2009 IMHO: As its XML i would use a loop, theirs other ways but your are able to count the nodes, so a foreach seams logical to me! Quote Link to comment https://forums.phpfreaks.com/topic/153065-logic-help/#findComment-803942 Share on other sites More sharing options...
Maq Posted April 7, 2009 Share Posted April 7, 2009 I suggest you use DOM and XPath. These features are made for reading and parsing XML. Quote Link to comment https://forums.phpfreaks.com/topic/153065-logic-help/#findComment-804017 Share on other sites More sharing options...
MadTechie Posted April 7, 2009 Share Posted April 7, 2009 Just as a note: i did assume you was using DOM, so i second that.. Quote Link to comment https://forums.phpfreaks.com/topic/153065-logic-help/#findComment-804025 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.