actionscript wont loop xml

Hi,

I have some code below. generally speaking, it works, but it wont loop dislpay all text in the datagrid.

background - I load an xml file into a datagrid, when a row is clicked, a function is called and that funtion populates various text boxes etc. It also populates another datagrid, unfortunately, it only reads the first line of a particlar node, it is the correct node but it wont display the rest of the nodes.

below is a portion of the xml and i am pulling type_name and the loop is the get all 'type_name' by reading ./ext_refs/ext_ref;

<ext_refs>
      <ext_ref type_name="Secunia Advisory ID" indirect="0">13942</ext_ref>
      <ext_ref type_name="Other Advisory URL" indirect="0">http://www.idefense.com/application/poi/display?id=188&amp;type=vulnerabilities</ext_ref>
      <ext_ref type_name="Vendor URL" indirect="0">http://www.3com.com/products/en_US/detail.jsp?tab=features&amp;pathtype=purchase&amp;sku=3CRWE454G72</ext_ref>
      <ext_ref type_name="CVE ID" indirect="0">2005-0112</ext_ref>
      <ext_ref type_name="Security Tracker" indirect="0">1012958</ext_ref>
      <ext_ref type_name="ISS X-Force ID" indirect="0">18994</ext_ref>
      <ext_ref type_name="Bugtraq ID" indirect="0">12322</ext_ref>
</ext_refs>


heres the code within my highlight function which is triggered when the first datagrid is clicked;

      myDg = new Array();
      for(var i=0; i<eindex.length; i++) {
                  var typeExtRef = XPath.selectNodes(choosenEntryData[i],"./ext_refs/ext_ref")[0].attributes.type_name;
                  var typeLinkId = XPath.selectNodes(choosenEntryData[i],"./ext_refs/ext_ref")[0].firstChild.nodeValue;
                  myDg.push({Type:typeExtRef,Ref:typeLinkId});
                      }
        dgExtRef.dataProvider = myDg;
      }


note, eindex is a variable which refers to selectedItem ID in the first datagrid. (this works ok and points to the correct part of the xml file).

when I run mymovie, as I mentioned, it picks up the first type_name attributes correctly and puts it into my second datagrid dgExtRef, however, I can see that it loaded the rest into the grid but the text does not show, when you move the mouse over it, you can see the rows highlight so something is there !


any suggestions would be apreciated

cheers.
LVL 5
tmehmetAsked:
Who is Participating?
 
negatyveCommented:
I'm not sure I understand what you want, but maybe that's what you are trying to do:

      var myDg = new Array();
      var typeExtRef = XPath.selectNodes(eindex, "./ext_refs/ext_ref");
      for (var i = 0; i < typeExtRef.length; i++) {
            myDg.push({Type:typeExtRef[i].attributes.type_name, Ref:typeExtRef[i].firstChild.nodeValue});
      }
      dgExtRef.dataProvider = myDg;
0
 
tmehmetAuthor Commented:
apologies, above has a deliberate mistake, it looks like this;

 myDg = new Array();
     for(var i=0; i<eindex.length; i++) {
               var typeExtRef = XPath.selectNodes(eindex[i],"./ext_refs/ext_ref")[0].attributes.type_name;
               var typeLinkId = XPath.selectNodes(eindex[i],"./ext_refs/ext_ref")[0].firstChild.nodeValue;
               myDg.push({Type:typeExtRef,Ref:typeLinkId});
                     }
        dgExtRef.dataProvider = myDg;
     }
0
 
tmehmetAuthor Commented:
your a genius.

one day, i'll be in a position too not know what I am doing and still make it work

:-)

0
 
negatyveCommented:
:D cheers!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.