someone has suggested this
var el = x[i].getElementsByTagName("fieldname")[0];
if (el.childNodes && el.childNodes.length > 0) {
// access the nodeValue
}
else {
// don't
}
If I'm looping through the xml and using getElementsByTagName -
x[i].getElementsByTagName("fieldname")[0].childNodes[0].nodeValue
is there a way of checking whether that node exists?
This errors if the field is empty or the field doesn't exist at all so I want to test first before trying to...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.