I am loading XML from a remote source. Then i am attempting to transverse it to 
get to the value of the 'loc' node. However, everything I am doing is coming up 
empty or an error. i am putting money its the namespace, but I dont know how to 
get around it.

I am using a pretty basic function to convert the result to an XML object.

list = new XML(e.target.data);

I tried list.url[0].loc, but it comes up blank.


When I trace (list.toXMLString()); I get this:
<urlset>
   <url>
     <loc>http://www.nmh.org/nm/2-9991</loc>
     <lastmod>2010-01-10T10:07:22-06:00</lastmod>
     <changefreq>monthly</changefreq>
     <priority>.5</priority>
   </url>
   <url>
     <loc>http://www.nmh.org/nm/2-9992</loc>
     <lastmod>2010-01-10T10:07:24-06:00</lastmod>
     <changefreq>monthly</changefreq>
     <priority>.5</priority>
   </url>
   <url>
     <loc>http://www.nmh.org/nm/2-9998</loc>
     <lastmod>2010-01-10T10:07:34-06:00</lastmod>
     <changefreq>monthly</changefreq>
     <priority>.5</priority>
   </url>
</urlset>



When I trace (list.*), I get this:
<url xmlns="http://www.sitemaps.org/schemas/sitemap/0.9";  
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
   <loc>http://www.nmh.org/nm/2-9770</loc>
   <lastmod>2010-01-10T09:58:32-06:00</lastmod>
   <changefreq>monthly</changefreq>
   <priority>.5</priority>
</url>
<url xmlns="http://www.sitemaps.org/schemas/sitemap/0.9";  
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
   <loc>http://www.nmh.org/nm/2-9771</loc>
   <lastmod>2010-01-10T09:58:35-06:00</lastmod>
   <changefreq>monthly</changefreq>
   <priority>.5</priority>
</url>
<url xmlns="http://www.sitemaps.org/schemas/sitemap/0.9";  
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
   <loc>http://www.nmh.org/nm/2-9772</loc>
   <lastmod>2010-01-10T09:58:38-06:00</lastmod>
   <changefreq>monthly</changefreq>
   <priority>.5</priority>
</url>
<url xmlns="http://www.sitemaps.org/schemas/sitemap/0.9";  
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
   <loc>http://www.nmh.org/nm/2-9773</loc>
   <lastmod>2010-01-10T09:58:39-06:00</lastmod>
   <changefreq>monthly</changefreq>
   <priority>.5</priority>
</url>


How to I get to the values of loc?


Here is a sample of the raw XML:

<urlset xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9  
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd";>
−
<url>
<loc>http://www.nmh.org/nm/location+centers</loc>
<lastmod>2010-06-10T02:13:31-06:00</lastmod>
<changefreq>monthly</changefreq>
<priority>.9</priority>
</url>
−
<url>
−
<loc>http://www.nmh.org/nm/location+clinics+specialty+services</loc>
<lastmod>2010-06-10T02:27:03-06:00</lastmod>
<changefreq>monthly</changefreq>
<priority>.9</priority>
</url>
−
<url>
−
<loc>http://www.nmh.org/nm/location+emergency+urgent+care</loc>
<lastmod>2010-06-10T03:03:30-06:00</lastmod>
<changefreq>monthly</changefreq>
<priority>.9</priority>
</url>
−
<url>
<loc>http://www.nmh.org/nm/location+gift+shops+dining</loc>
<lastmod>2010-06-10T02:25:39-06:00</lastmod>
<changefreq>monthly</changefreq>
<priority>.9</priority>
</url>
</urlset>


Reply via email to