I'm not really up on my xml, but i think your problem is here:
Code:
x[i].getElementsByTagName("oil")[0].childNodes[0].nodeValue);
you're repeating yourself there by typing
x[i].getElementsByTagName("oil")[0]
You've already defined
x as being
xmlDoc.getElementsByTagName("oil") so that means you're writing:
xmlDoc.getElementsByTagName("oil").getElementsByTagName("oil")[0]. So that's going to fail straight off the bat.
It's not a huge deal for just getting things working, but for validation purposes, avoid using document.write
Take a look at the code here on this page and it should set you on the right path. You'll notice it uses
document.createElement and
document.createTextNode instead of document.write. That's the proper DOM way to do it.
JavaScript - Import XML Document