title: javascript--can't get textContent of [Object Text]?
body: <p>I want the script to find where it says, "anyword" in the xml (within the tag of course), and stop on that.  the below accomplishes that fine.  </p>
  
  <pre><code> var xmlDoc = loadXMLDoc("nhl.xml");
      var x = xmlDoc.getElementsByTagName("tagname");
      for (var i=0;i&lt;=x.length;i++){
          if (x[i].textContent = "anyword") {
              var variable = x[i].textContent;
          }
      }
  </code></pre>
  
  <p>However I want to take it one step further and be able to set 'variable' to the next node after it finds 'anyword'.  so i tried something like this and it came back with the very last element in the collection, instead of the next one.</p>
  
  <pre><code>var xmlDoc = loadXMLDoc("nhl.xml");
      var x = xmlDoc.getElementsByTagName("tagname");
      for (var i=0;i&lt;=x.length;i++){
          if (x[i].textContent = "anyword") {
              var variable = x[i+1].textContent;
          }
      }
  </code></pre>
  
  <p>so i edited the last line again and made it</p>
  
  <pre><code>var variable = x[i].nextSibling.textContent;
  </code></pre>
  
  <p>this came back null.  ripping my hair out here.  if it helps to answer any, if i just put it <code>x[i].nextSibling</code> it comes back <code>[Object Text]</code> </p>
  
  <p>any help?</p>