I don;t know why the copy paste did no work properly.

private var xml1:XML = 
                <url>
                    http://www.nmh.org/nm/location+centers
                    <lastmod>2010-06-10T02:13:31-06:00</lastmod>
                    <changefreq>monthly</changefreq>
                    <priority>.9</priority>
                </url>
                <url>
                    http://www.nmh.org/nm/location+clinics+specialty+services
                    <lastmod>2010-06-10T02:27:03-06:00</lastmod>
                    <changefreq>monthly</changefreq>
                    <priority>.9</priority>
                </url>
                <url>
                    http://www.nmh.org/nm/location+emergency+urgent+care
                    <lastmod>2010-06-10T03:03:30-06:00</lastmod>
                    <changefreq>monthly</changefreq>
                    <priority>.9</priority>
                </url>
                <url>
                    http://www.nmh.org/nm/location+gift+shops+dining
                    <lastmod>2010-06-10T02:25:39-06:00</lastmod>
                    <changefreq>monthly</changefreq>
                    <priority>.9</priority>
                </url>
            </urlset>;        


You need to alter the class who produces your xml on the server to produce both 
the the namespace and the chema.
Iterating is simple e4x syntax.

trace(xml1.url.loc.text());

that produces a list of the loc nodes when queired ...
I'll try to connect on your endpoint later if have the time and post the code. 
Is As code enough or you are using HTTPService and flex?

C




________________________________
From: Wally Kolcz <wko...@isavepets.com>
To: flexcoders@yahoogroups.com
Sent: Thu, August 26, 2010 4:55:28 PM
Subject: Re: [flexcoders] Perplexed: An XML Love Story

   
Ok, how do I do that? Also, in your example, how are you iterating     over the 
url node value to get multiples?

On 8/26/2010 10:49 AM, claudiu ursica wrote:

  
>Ok had a look into the raw xml also. You need to                 define a 
>namespace for the schemaLocation to be bound                 to. 
>
>
>
>
>Here is the code that works on my machine ...
>
>package {
>    import flash.display.Sprite;
>    
>    public class Test extends Sprite
>    {
>        
>        private var xml:XML = 
>            <urlsset>
>                <url>
>                    http://www.nmh.org/nm/2-9991
>                                    
<lastmod>2010-01-10T10:07:22-06:00</lastmod>
>                                    <changefreq>monthly</changefreq>
>                    <priority>.5</priority>
>                </url>
>                <url>
>                    http://www.nmh.org/nm/2-9992
>                                    
<lastmod>2010-01-10T10:07:24-06:00</lastmod>
>                                    <changefreq>monthly</changefreq>
>                    <priority>.5</priority>
>                </url>
>                <url>
>                    http://www.nmh.org/nm/2-9998
>                                    
<lastmod>2010-01-10T10:07:34-06:00</lastmod>
>                                    <changefreq>monthly</changefreq>
>                    <priority>.5</priority>
>                </url>
>            </urlsset>;
>
>        private var xml1:XML = 
>                <url>
>                    http://www.nmh.org/nm/location+centers
>                                    
<lastmod>2010-06-10T02:13:31-06:00</lastmod>
>                                    <changefreq>monthly</changefreq>
>                    <priority>.9</priority>
>                </url>
>                <url>
>                    http://www.nmh.org/nm/location+clinics+specialty+services
>                                    
<lastmod>2010-06-10T02:27:03-06:00</lastmod>
>                                    <changefreq>monthly</changefreq>
>                    <priority>.9</priority>
>                </url>
>                <url>
>                    http://www.nmh.org/nm/location+emergency+urgent+care
>                                    
<lastmod>2010-06-10T03:03:30-06:00</lastmod>
>                                    <changefreq>monthly</changefreq>
>                    <priority>.9</priority>
>                </url>
>                <url>
>                    http://www.nmh.org/nm/location+gift+shops+dining
>                                    
<lastmod>2010-06-10T02:25:39-06:00</lastmod>
>                                    <changefreq>monthly</changefreq>
>                    <priority>.9</priority>
>                </url>
>            </urlset>;        
>        
>        
>        public function Test()
>        {
>            trace(xml.url.loc.text());
>            trace(xml1.url.loc.text());
>        }
>    }
>}
>
>HTH,
>C
>
>
>
>
>
________________________________
From: Wally Kolcz <wko...@isavepets.com>
>To: flexcoders@yahoogroups.com
>Sent: Thu, August 26, 2010 4:07:34 PM
>Subject: [flexcoders] Perplexed: An XML Love Story
>
>  
>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>
>http://www.nmh.org/nm/2-9991
><lastmod>2010-01-10T10:07:22-06:00</lastmod>
><changefreq>monthly</changefreq>
><priority>.5</priority>
></url>
><url>
>http://www.nmh.org/nm/2-9992
><lastmod>2010-01-10T10:07:24-06:00</lastmod>
><changefreq>monthly</changefreq>
><priority>.5</priority>
></url>
><url>
>http://www.nmh.org/nm/2-9998
><lastmod>2010-01-10T10:07:34-06:00</lastmod>
><changefreq>monthly</changefreq>
><priority>.5</priority>
></url>
></urlset>
>
>When I trace (list.*), I get this:
>
>http://www.nmh.org/nm/2-9770
><lastmod>2010-01-10T09:58:32-06:00</lastmod>
><changefreq>monthly</changefreq>
><priority>.5</priority>
></url>
>
>http://www.nmh.org/nm/2-9771
><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";>
>http://www.nmh.org/nm/2-9772
><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";>
>http://www.nmh.org/nm/2-9773
><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.9http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd";>
>
>−
><url>
>http://www.nmh.org/nm/location+centers
><lastmod>2010-06-10T02:13:31-06:00</lastmod>
><changefreq>monthly</changefreq>
><priority>.9</priority>
></url>
>−
><url>
>−
>http://www.nmh.org/nm/location+clinics+specialty+services
><lastmod>2010-06-10T02:27:03-06:00</lastmod>
><changefreq>monthly</changefreq>
><priority>.9</priority>
></url>
>−
><url>
>−
>http://www.nmh.org/nm/location+emergency+urgent+care
><lastmod>2010-06-10T03:03:30-06:00</lastmod>
><changefreq>monthly</changefreq>
><priority>.9</priority>
></url>
>−
><url>
>http://www.nmh.org/nm/location+gift+shops+dining
><lastmod>2010-06-10T02:25:39-06:00</lastmod>
><changefreq>monthly</changefreq>
><priority>.9</priority>
></url>
></urlset>
>
>
>

 


      

Reply via email to