12 Replies Latest reply on Apr 21, 2010 4:38 PM by icecappacino

    How to use E4x namespace

    icecappacino Level 1

      Ok. I have really been researching the use of the E4X usage. However, when it comes to the namespaces issue its ALOT confusion. How do you use E4X with xml with namespaces...

       

      I have this ATOM feed here

       

      and I'm using the following code to get the elements

       

           var ns = new Namespace('ts','http://www.triniscene.com/namespace');
             
              private function listGalleries(event:ResultEvent) {
                          default xml namespace = ns;
                          var t:XML = event.result as XML;
                          t.ignoreWhiteSpace = true;
                          t.prettyIndent = true;
                          Alert.show(t.namespace());
                          var m = (t.child(6).name());
                          Alert.show(m);
                          //galleriesListDG.dataProvider = t.channel.item;
                          var d = 1;
                      }

       

      When I use

       

      t.toXMLString()

      I get the whole xml structure which is good

       

      the

       

      t.namespace()

      gives me "http://www.w3.org/2005/Atom" (is that suppose to happen?)

       

      finally When I try to access

       

      t.child('entry')

      I get an error/ or nothing....

       

           When I check the name

       

      t.child(6).name()

      I get

      http://www.w3.org/2005/Atom::entry

      How can this be? entry is not a namespace tag....its not what is outputted in the XML structure. Why would it give me this?

       

      What happened to <entry>