rgb192
asked on
simplexml grab loc and priority
<?xml version="1.0" encoding="UTF-8"?>
-<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> -<url> <loc>http://website.com/</loc> <priority>1.0</priority> </url> -<url> <loc>http://www.website.com/portfolio/</loc> <priority>0.9</priority> </url> -<url> <loc>http://www.website.com/about/</loc> <priority>0.9</priority> </url> -<url> <loc>http://www.website.com/contact/</loc> <priority>0.9</priority> </url> -<url> <loc>http://www.website.com/portfolio/branding/</loc> <priority>0.8</priority> </url> -<url> <loc>http://www.website.com/portfolio/web-wordpress/</loc> <priority>0.8</priority> </url> -<url> <loc>http://www.website.com/portfolio/social-media/</loc> <priority>0.8</priority> </url> -<url> <loc>http://www.website.com/portfolio/print/</loc> <priority>0.8</priority> </url> -<url> <loc>http://www.website.com/portfolio/branding/cabrillo-youth-summer-institute.php</loc> </url> -<url> <loc>http://www.website.com/portfolio/branding/santacruz-popup-artparty.php</loc> </url> -<url> <loc>http://www.website.com/portfolio/branding/red-house.php</loc> </url> -<url> <loc>http://www.website.com/portfolio/branding/what-to-do-in.php</loc> </url> -<url> <loc>http://www.website.com/portfolio/branding/room-service.php</loc> </url> -<url> <loc>http://www.website.com/portfolio/branding/new-evolution.php</loc> </url> -<url> <loc>http://www.website.com/portfolio/branding/film-production-studio.php</loc> </url> -<url> <loc>http://www.website.com/portfolio/branding/rogueIBO.php</loc> </url> -<url> <loc>http://www.website.com/portfolio/branding/booster-bath.php</loc> </url> -<url> <loc>http://www.website.com/portfolio/branding/pilar-macchione.php</loc> </url> -<url> <loc>http://www.website.com/portfolio/branding/katie-mcmahon.php</loc> </url> -<url> <loc>http://www.website.com/portfolio/branding/genesis.php</loc> </url> -<url> <loc>http://www.website.com/portfolio/branding/tequila-jacks.php</loc> </url> -<url> <loc>http://www.website.com/portfolio/branding/em-integrated.php</loc> </url> -<url> <loc>http://www.website.com/portfolio/branding/em.php</loc> </url> -<url> <loc>http://www.website.com/portfolio/branding/orignauxmoose.php</loc> </url> -<url> <loc>http://www.website.com/portfolio/branding/corey-gegner.php</loc> </url> -<url> <loc>http://www.website.com/portfolio/branding/trey-hock.php</loc> </url> -<url> <loc>http://www.website.com/portfolio/branding/nathan-jones.php</loc> </url> -<url> <loc>http://www.website.com/portfolio/branding/morgan-victoria.php</loc> </url> </urlset>
using simplexml
want to echo loc and priority on each line
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Footnote... It looks like you may have copied the XML from a display made with Internet Explorer or similar. You need to be careful about that because of all of the hyphens that get inserted into the display listing. Those characters make the XML document invalid and it requires an extra step to remove them before you can process the document.
ASKER
Both work great. Thanks
I like that there is a children option
$firstLvl->children()
I like that there is a children option
$firstLvl->children()