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. 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! 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. 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.. Link to comment https://forums.phpfreaks.com/topic/153065-logic-help/#findComment-804025 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.