n3mesis125 Posted August 7, 2009 Share Posted August 7, 2009 Hey Folks, I have something simliar to this in XML but i'm not sure how to access the attributes of each row. Is there an easy foreach() statement I can do to access the attributes? Basically I'm trying to loop through the below items and only spit out the solarSystemName data for each row set. <?xml version='1.0' encoding='UTF-8'?> <eveapi version="2"> <currentTime>2007-12-14 20:19:41</currentTime> <result> <rowset name="solarSystems" key="solarSystemID" columns="solarSystemID,allianceID,constellationSovereignty,sovereigntyLevel,factionID,solarSystemName"> <row solarSystemID="30023410" allianceID="0" constellationSovereignty="0" sovereigntyLevel="0" factionID="500002" solarSystemName="Embod" /> <row solarSystemID="30001597" allianceID="1028876240" constellationSovereignty="0" sovereigntyLevel="3" factionID="0" solarSystemName="M-NP5O" /> <row solarSystemID="30001815" allianceID="389924442" constellationSovereignty="0" sovereigntyLevel="3" factionID="0" solarSystemName="4AZV-W" /> <row solarSystemID="30001816" allianceID="0" constellationSovereignty="0" sovereigntyLevel="0" factionID="0" solarSystemName="UNV-3J" /> <row solarSystemID="30000479" allianceID="0" constellationSovereignty="824518128" sovereigntyLevel="0" factionID="0" solarSystemName="SLVP-D" /> <row solarSystemID="30000480" allianceID="824518128" constellationSovereignty="824518128" sovereigntyLevel="3" factionID="0" solarSystemName="0-G8NO" /> </rowset> <dataTime>2007-12-14 14:49:43</dataTime> </result> <cachedUntil>2007-12-15 02:19:41</cachedUntil> </eveapi> Quote Link to comment https://forums.phpfreaks.com/topic/169271-reading-xml-into-php/ Share on other sites More sharing options...
mikesta707 Posted August 7, 2009 Share Posted August 7, 2009 here is a basic tutorial on the XML DOM and XML parser that PHP has built in. http://www.w3schools.com/php/php_xml_dom.asp Quote Link to comment https://forums.phpfreaks.com/topic/169271-reading-xml-into-php/#findComment-893236 Share on other sites More sharing options...
Maq Posted August 7, 2009 Share Posted August 7, 2009 Something similar with an extensive library is the simpleXML extension. Quote Link to comment https://forums.phpfreaks.com/topic/169271-reading-xml-into-php/#findComment-893239 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.