Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8981533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:21:37+00:00 2026-06-15T20:21:37+00:00

I get data from XML. I need to check data and if data is

  • 0

I get data from XML. I need to check data and if data is null I must hide this.

How can I check?

  <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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:21:38+00:00Added an answer on June 15, 2026 at 8:21 pm

    You can simply do a if (!myVariable) check on any given variable. If that returns true (that is to say if the code enters the if body, then the data is null. What I would do is instead of doing this:

    var oid = markers[i].getAttribute("objectid");
    // ...
    ..."ObjectID:"  + oid + "
    

    Include your title in the variable, like this:

    var oid = markers[i].getAttribute("objectid");
    if (oid) {
        oid = "ObjectID: " + oid;
    }
    

    and that way you can add oid directly to your string. If the value is null, adding it will have no effect because the variable will be empty. If there was a value, then the title will be appended and doing a + oid will append the title and value at the same time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to get the data from this XML file, and I think deserializing
I need to get data from xml file <?xml version=1.0?> <xml> <User> <Agent> <id>cr4523</id>
Hi I'm struggling to get data from an xml file in php... the xml
I'm working with XML data from an application where we get XML like this:
i get my pagedata from an xml and i want this data to be
How can I get data from an xml web service (say, the value of
I need to get data from an XML file and store it into a
I get this kind of data from XML document : 2012-08-29T18:18:00+02:00 and I'd like
Can I read a XML file from remote server such as http://dealer.somedomain.com/data/inventory.xml I need
How could I get the data from a xml, which is generated with php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.