You can extract it like this as well:

var ns:Namespace = myXML.namespace();

--
Kenneth Kawamoto
http://www.materiaprima.co.uk/

Eric E. Dolecki wrote:
I ended up with this

1. function onLoadXML( e:Event ):void 2. { 3. var ns:Namespace = new Namespace("http://www.xignite.com/services/";); 4. var myXML:XML = new XML( e.target.data ); 5. 6. trace( "Name " + myXML.ns::Name ); 7. trace( "Last " + myXML.ns::Quote.ns::Last ); 8. trace( "Price Earnings " + myXML.ns::Statistics.ns::Price_Earnings ); 9. trace( myXML.ns::News.ns::StockNews.ns::Headline[0] ); 10. var len:Number = myXML.ns::News.ns::StockNews.ns::Headline.length(); 11. trace( myXML.ns::News.ns::StockNews.ns::Headline[len-1]); 12. }


On Fri, Feb 13, 2009 at 5:10 PM, Kenneth Kawamoto <[email protected] <mailto:[email protected]>> wrote:

    trace(myXML.children().(localName() == "Outcome"));

-- Kenneth Kawamoto
    http://www.materiaprima.co.uk/


    Eric E. Dolecki wrote:

        Maybe it's Friday and I'm tired, but this just seems so weird.
        Something I
        have done 8 billions times before and now things are acting up. Code
        couldn't be much more simple.
        var myLoader:URLLoader = new URLLoader();
        myLoader.addEventListener( Event.COMPLETE, onLoadXML );
        myLoader.load( new URLRequest( "
        http://www.xignite.com/xquotes.asmx/GetQuote?Symbol=AAPL"; ));

        function onLoadXML( e:Event ):void
        {
        var myXML:XML = new XML( e.target.data );
        trace( myXML);
        }

        I get this:

        <ExtendedQuote xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xmlns:xsd="http://www.w3.org/2001/XMLSchema";
        xmlns="http://www.xignite.com/services/";>
         <Outcome>Success</Outcome>
         <Message>Delay times are 15 mins for NASDAQ, NYSE and
        AMEX.</Message>
         <Identity>Cookie</Identity>
         <Delay>0.515625</Delay>
         <Name>Apple Inc.</Name>
         <Exchange>NASDAQ</Exchange>
         <Quote>
           <Symbol>AAPL</Symbol>
           <Previous_Close>99.27</Previous_Close>
           <Open>99.11</Open>
           <High>99.80</High>

        ...

        In a browser I get this (for the URL):

        <?xml version="1.0" encoding="utf-8"?>
        <ExtendedQuote xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xmlns:xsd="http://www.w3.org/2001/XMLSchema";
        xmlns="http://www.xignite.com/services/";>
         <Outcome>Success</Outcome>
         <Message>Delay times are 15 mins for NASDAQ, NYSE and
        AMEX.</Message>
         <Identity>Cookie</Identity>
         <Delay>0.515625</Delay>
         <Name>Apple Inc.</Name>
         <Exchange>NASDAQ</Exchange>
         <Quote>
           <Symbol>AAPL</Symbol>
           <Previous_Close>99.27</Previous_Close>
           <Open>99.11</Open>
           <High>99.80</High>

        Note the red definition there. I don't get that in my XML in AS3.
        Anyway, When I try to trace out myXML.ExtendedQuote, I get nothing.
        When I trace out myXML.Name, I get nothing. I don't see namespaced
        nodes anywhere, so what exactly is going on? I just want to get at
        some of that data sitting in simple nodes. So freaking weird.

        Thanks for any insight,
        Eric

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to