the result it returns is 1. I don't understand why. How does it calculate the length ?
next question, for the same xml file,
the result is 7. How come ? I was thinking the child elements of "student" is 3 (name, rollno, address) it should return 3. how come it returned 7.
please explain me as I have been trying to draw the schematic diagram and tried my best to undestand but couldn't get through...
thanks
You're asking how it calculates the "length" of a NodeList? That would be the number of the elements in the NodeList.
In your example you found a NodeList containing all of the <student> elements in your document. There's only one such element. Therefore the NodeList contains just one element. So it shouldn't be a surprise that the "length" of the NodeList is one.
As for the child nodes of that one <student> element, they are: