1 Reply Latest reply on Aug 3, 2006 1:11 PM by adolfo_chavez

    flash and xml

      I posted this to the chattyfig list, but it seems to be down. I'll try my luck here!


      so i kinda got my questions answered by Drew Shefman (flash developer in Houston,
      TX): There were two problems: one, the .ignoreWhitespace = true; has to be AFTER
      you pass the xmlText into the new XML(); the second problem was that i didn't
      parse the xml.....

      but now i'm having problems referring to elements beyond the first element beyond the root element. I can get to the title, but i can't seem to get to the author listing. see the
      xml in my previous msg (down below) and the current code i have in my .fla:

      //here i am trying to get the xml from a txt field offstage rather than from an external document

      var inHousexml:XML;
      inHousexml = new XML(xmlText.text);
      inHousexml.ignoreWhite = true;
      var title:XMLNode = inHousexml.firstChild.firstChild;
      trace("::THIS IS THE TITLE:: "+title.attributes.id);//traces the title correctly
      var authPath:XMLNode = [title].firstChild.firstChild.childNodes;
      trace("::THIS IS SUPPOSED TO BE THE AUTHOR ELEMENT LISTING:: "+authPath);//expecting authors element listing but returning undefined ... why?
      trace("::THIS IS A TRACE OF THE XML:: "+inHousexml); //returns xml element listing
      trace("::THIS IS THE inHousexml+firstChild:: "+inHouse.xml.firstChild); //returns undefined
      trace("::THIS IS THE inHousexml+firstChild.firstChild+the nodeName attribute:: "+inHousexml.firstChild.firstChild.nodeName); //returns title
      trace("::THIS IS THE inHousexml+firstChild.firstChild.firstChild.firstChild:: "+inHousexml.firstChild.firstChild.firstChild.firstChild); //returns undefined

      and here is the (very simple) xml i have pasted into a dynamic txt field off stage (instance name: xmlText):

      <title id="Percutaneous biopsy of head and neck lesions using image guidance: various approaches and relevant anatomical and technical considerations"></title>
      <subauthor>Joy A. Henningsen, M.D.</subauthor>
      <subauthor>Sanjay Gupta, M.D.</subauthor>
      <subauthor>Michael J. Wallace, M.D.</subauthor>
      <subauthor>Kamran Ahrar, M.D.</subauthor>
      <subauthor>David C. Madoff, M.D.</subauthor>
      <subauthor>Marshall E. Hicks, M.D.</subauthor>
      <subauthor>Ravi Murthy, M.D.</subauthor>
      <subauthor>Stephen E. McRae, M.D.</subauthor>

      Any help much appreciated. thanks.