Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 20th, 2007, 02:07 AM
Registered User
 
Join Date: Jul 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Accesing ChildNode resets index

Hi,
Im having some trouble with XML part of my application.

I grab a bunch of nodes by unsing:
           list = xmlDoc.getElementsByTagName("KEYWORD")
Then I check its length with alert(list.length) = 7500

So I loop through the nodes..
for (var i=0;i < list.length;i++)
  {
      var word = list[i].childNodes[0].nodeValue
  }

i only gets to 295, but if I remove the childNodes statement it gets to 7500?????

Thanks for any help

Dan

 
Old May 20th, 2007, 02:13 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

What do you mean by "it only gets to 295"? The script crashes? Are some of the KEYWORD elements empty?

--

Joe (Microsoft MVP - XML)
 
Old May 20th, 2007, 03:47 PM
Registered User
 
Join Date: Jul 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The counter 'i' in the for loop only gets to 295, when it should be going through the entire length of 'list' (7500 items). The script does not crash. KEYWORD elements are not empty

Thanks for the response
Dan

 
Old May 21st, 2007, 03:59 PM
Registered User
 
Join Date: Jul 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

My humble appologies...... One of the KEYWORD elements was blank. Thanks Joe






Similar Threads
Thread Thread Starter Forum Replies Last Post
DropDownList resets itself (ASP.NET 2.0 AJAX) aisa ASP.NET 2.0 Basics 0 June 11th, 2008 06:12 PM
restarting MySQL service resets all my privileges crmpicco MySQL 0 January 27th, 2006 11:33 AM
Accesing COM+ components from c# txerra General .NET 2 June 24th, 2005 05:23 AM
select childnode of a node with xmlns:xsl attribut beaster XSLT 3 January 13th, 2005 12:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.