10 Replies Latest reply on Jan 17, 2010 5:21 PM by kglad

    Getting inside others XML nodes programmatically, based on a single known node

    baianomauricioct

      Hi guys, I have an array being generated with numbers from an XML file. Then I have the function 'maxF' that returns the maximum number inside that array. I need to get programaticaly other nodes inside the same XML file [where all these numbers are coming from] to print the date [which is a node on top of the number node]. Does anyone out there can please help me do that?

       

      Thank you very much

       

                var a:Array = [];           for (var i = 1; i<=15; i++) {                var RootNode = getXml.firstChild;                eval("price"+i).htmlText = "

      "+RootNode.childNodes[i].childNodes[4].childNodes[2].firstChild+"

      ";                eval("price"+i+15).htmlText = "

      "+RootNode.childNodes[i+15].childNodes[4].childNodes[2].firstChild+"

      ";                //trace(stripF(RootNode.childNodes[i+15].childNodes[4].childNodes[2].first Child.nodeValue));                a.push(Number(stripF(tl["price"+i].text)));                a.push(Number(stripF(tl["price"+i+15].text)));           }           lowestup.htmlText = "

      "+maxF(a)+"

      ";           lowestPeriodTitle.htmlText = "

      OPTIMAL VALUES IDENTIFIED:

      ";       function maxF(a:Array):Number {      var max:Number = a[0];      for (var i:Number = 1; i>a.length; i++) {           if (a[i]>min) {                max = a[i];           } else {                //trace("buahMin!");           }      }      return max; } function stripF(s:String):String {      return s.split(" ").join("").split("\n").join("").split("\r").join(""); }