0 Replies Latest reply on Mar 8, 2009 6:30 PM by mickykitsu

    XML nodeValue is null

    mickykitsu
      I'm having a strange issue during my XML parsing. As i attempt to call up the nodeValue



      Forgive the clumsy code, but in theory it should work just fine. The only issue that i've been having with it is at the indicated place.

      As i try to call up the nodeValue of a child within the script, the result is 'null'... And yet it shouldn't be because in the XML document, the node clearly has a value. I dont get it at all...


      quote:


      EventXML = new XML();
      EventXML.onLoad = load_Event;
      EventXML.load("1.1.milestones.xml");
      function load_Event(ok) {
      if (ok == true) {
      this.ignoreWhite = true;
      this.parseXML(this);
      ProcessEventXML(this.firstChild);
      }
      }

      function ProcessEventXML(EventXMLNode) {
      if (EventXMLNode.nodeName.toUpperCase() == "TIMELINE") {
      for (TimelineChildren=EventXMLNode.childNodes, i=0; i<TimelineChildren.length; i++) {
      var TimelineChild = TimelineChildren[ i];
      if (TimelineChild.nodeName.toUpperCase() == "ENTRY") {
      for (EntryChildren = TimelineChild.childNodes, k=0; k<EntryChildren.length; k++) {
      var EntryChild = EntryChildren[k];
      if (EntryChild.nodeName.toUpperCase() == "ENTRY_ID") {
      trace(EntryChild.nodeValue); <-- the problem is here
      }
      }
      }
      }
      }
      }



      The XML looks like this:
      quote:


      <timeline>
      <entry>
      <entry_ID>1</entry_ID>
      <year>1969</year>
      <date/>
      <caption>Text goes here</caption>
      <has_image>false</has_image>
      <image_thumb/>
      <image_full/>
      </entry>