0
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.

2 Answers 2

1

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

?

Sign up to request clarification or add additional context in comments.

1 Comment

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

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

<feedbackCorrect>any value</feedbackCorrect>

?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.