我从 XML 获取数据。我需要检查数据,如果数据为空,我必须隐藏它。
我该如何检查?
<script>
downloadUrl("gxml.php", function(data) {
var xml = data.responseXML;
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var oid = markers[i].getAttribute("objectid");
var status = markers[i].getAttribute("status");
var title = markers[i].getAttribute("title");
var volume = markers[i].getAttribute("volume");
var kwh = markers[i].getAttribute("kwh");
var puser = markers[i].getAttribute("puser");
var ucomp = markers[i].getAttribute("ucomplate");
var udate = markers[i].getAttribute("udate");
var suser = markers[i].getAttribute("suser");
var scomp = markers[i].getAttribute("scomplate");
var sdate = markers[i].getAttribute("sdate");
var type = markers[i].getAttribute("type");
var point = new google.maps.LatLng(
parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var html = "ObjectID:" + oid + " <br/> Title:" + title +" <br/>Status:" + status + " <br/>Volume:" + volume + " <br/> KWh:" + kwh + " <br/>User:" + puser + " <br/> User Date:" + udate + " <br/> User Complate :" + ucomp + " <br/>Super user:" + suser + " <br/> S .User Date:" + sdate + " <br/> S. User Complate :" + scomp + "<br/> <a href=\"edit.php\">Add/Edit</a>";
</script>
// this data i get from xml. i`m need to chek this null or not null