0 Replies Latest reply on Apr 2, 2007 8:36 AM by m10461

    xml attribute value

    m10461
      I'm having trouble getting a specific attribute value when
      parsing the xml tree. I need to get the chidNode that matches my attribute
      request. Is there an easy way to say if the attribute value = 1234 then return
      its nodevalue


      myXML = new XML();
      myXML.load("sample.xml");
      myXML.ignoreWhite = true;
      myXML.onLoad=feeds;

      function feeds(){
      myroot = myXML.firstChild;
      people = myroot.firstChild;
      students = people.childNodes;
      if(students.attributes.id == '1234')
      {
      trace('yes record found')
      }
      }

      the xml at the students level lookss like this

      <student id="2214">
      <name></name>
      </student>
      <student id="1234">
      <name></name>
      </student>
      <student id="4567">
      <name></name>
      </student>


      thanks