tags:

views:

41

answers:

2

test[_nObjectives].pool[j].feedbackCorrect = oQuestions[j].getElementsByTagName("feedbackCorrect")[0].firstChild.data;

and the XML in this case contains this:

  <feedbackCorrect>
  </feedbackCorrect>

When executing that line of code the following error occurs: Message: Object required

I don't get it. The tag is there, if it is empty the error occurs and even has spaces chars it doesn't work.

+1  A: 

you are getting the error because

oQuestions[j].getElementsByTagName("feedbackCorrect")[0]

is returning that tag, and the .firstChild is returning null, because it has no children...

Are you sure you dont want

oQuestions[j].getElementsByTagName("feedbackCorrect")[0].data

?

TJMonk15
but why it is working when the xml is like this:<feedbackCorrect>any value</feedbackCorrect>?
A: 

but why it is working when the xml is like this:

<feedbackCorrect>any value</feedbackCorrect>

?