• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

beginner DOM iteration problem

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, all ranchers!
My question is if there is any one here who can see what i am doing wrong with the current code sample. I have done this before but i cant
get it right this time. Is there anyone here that can help me to see what i am doing wrong? I would be very greatful for any hint or tip posted here.
My problem is that i must store values from a xml file in a array of String objects but i keep getting null values when i print out the array in
question. Here is my code so far.

Here is the beginning of the java code for the question in mind ...

And this is where i always get stuck. I keep getting null values in my contacts array when I am looping through it. I know there must be a lot of errors in my java code
but i am a complete rookie with so far only basic knowledges. I cant see why null values are stored in the contacts array? Can anyone explain what i am doing wrong and the origin of
the null values. Any hint or tip will be very much appreciated.
 
Marshal
Posts: 28296
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Starting at line 21 you set four variables to null.

Then from lines 26 to 40 you have some code which can change at most one of those variables. So at least three of them must still be null after line 40.
 
The fastest and most reliable components of any system are those that are not there. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic