2 Replies Latest reply on Oct 19, 2009 3:12 AM by dc2698

    xml problem.....please help

    dc2698

      hi i am doing a news ticker and have this code for the xml part:

       

      var xmlDoc = new XML();
      xmlDoc.ignoreWhite = true;
      xmlDoc.onLoad = isLoaded;
      xmlDoc.parseXML("<items news=\"_\"><item link=\"\" target-frame=\"_self\" font-face=\"Arial\" font-size=\"12\" font-color=\"16777215\" higlight-color=\"12632256\"><![CDATA[11]]></item><item link=\"\" target-frame=\"_self\" font-face=\"Arial\" font-size=\"12\" font-color=\"16777215\" higlight-color=\"12632256\"><![CDATA[22]]></item><item link=\"\" target-frame=\"_self\" font-face=\"Arial\" font-size=\"12\" font-color=\"16777215\" higlight-color=\"12632256\"><![CDATA[33]]></item><item link=\"\" target-frame=\"_self\" font-face=\"Arial\" font-size=\"12\" font-color=\"16777215\" higlight-color=\"12632256\"><![CDATA[44]]></item></items>");
      xmlDoc.onLoad(true);

       

      function isLoaded(success)
      {
          if (!success)
          {
              return (0);
          } // end if

       

          objArray = new Array();
          var fChildNodes = this.firstChild.childNodes;
          i = -1;
         
          while (i++, i < fChildNodes.length)
          {
              var node_ = fChildNodes[i];
              obj_ = new Object();
              obj_.link = node_.attributes.link;
              obj_.target = node_.attributes["target-frame"];
              obj_.htmlText = "<font face=\"" + node_.attributes["font-face"] + "\" size=\"" + node_.attributes["font-size"] + "\">" + node_.firstChild.nodeValue + "</font>";
              obj_.higlight_color = node_.attributes["higlight-color"];
              obj_.color = node_.attributes["font-color"];
              objArray.push(obj_);
          } // end while
          texts_count = fChildNodes.length;
          fl_loaded = true;
      } // End of the function

       

      all works fine but when i replace xmlDoc.parseXML("....") with xmlDoc.load("news.xml") where news.xml contains same thing in xmlDoc.parseXML("...."), nothing is pushed into the objArray array (obj_ empty?).

       

      how shall i load the news.xml in order to put data into obj_ object please?

       

      thanks in advance!