I'm trying to parse a xml from tht thetvdb.com, the problem is that some tv series don't have a name in english so the tags look like this: http://www.thetvdb.com/api/92DBDD8C9816A59C/series/256618/
you only have </SeriesName> and the <SeriesName> is missing.
when I try to print the names like this: console.log("name: " + serieNameT[0].childNodes[0].nodeValue);
my code stops in series like that and the error is 'TypeError'.
how can I pass this elements without problems?
thanks!
<SeriesName/>, not</SeriesName>in the file. Self closing tags are valid in XML. It looks like your problem is that this empty node does not have achildNodesattribute or it is empty and hence you cannot access the first element. It should not be difficult to test whetherserieNameT[0].childNodes[0]exists.