Jump to content

[SOLVED] Java and XML


hellouthere

Recommended Posts

Is there some kind of limit of the vaiable name length or amount of variables that can be called in the same script? I have a perfectly good working script that uses google maps, it writes data to an xml file and then another script puts markers and info on  google maps... i have it working for some variables...

 

var request = GXmlHttp.create();
request.open('GET', 'cougarmark.xml', true);
request.onreadystatechange = function() {
  if (request.readyState == 4) {
        var xmlDoc = request.responseXML;
        var markers = xmlDoc.documentElement.getElementsByTagName("marker");
        for (var i = 0; i < markers.length; i++) {
        var title = markers[i].getAttribute("title")
        var text = markers[i].getAttribute("text")
        var color = markers[i].getAttribute("type")
        var dep = markers[i].getAttribute("dep")
        var dest = markers[i].getAttribute("dest")
        var alt = markers[i].getAttribute("alt")
        var gs = markers[i].getAttribute("gs")
        var point = new GPoint(parseFloat(markers[i].getAttribute("lng")),parseFloat(markers[i].getAttribute("lat")));
        var marker = createMarker(point, title, text,dep,dest,alt,gs, color);
          map.addOverlay(marker);
        }
  }
}

 

but when i try to add another variable and call it in the display box the markers do not appear... this is the variable that i am calling...

 

var dest = markers[i].getAttribute("dest")
        var alt = markers[i].getAttribute("alt")
        var airline = markers[i].getAttribute("airline") <-- new variable
        var gs = markers[i].getAttribute("gs")

 

this is the code for the display box...

 

new GInfoWindowTab("Pilot Info", "<div align=\"left\">Name: "+ title + "</div><div align=\"left\">Callsign: "+ text + "</div><div align=\"left\">Airline: "+ airline + "</div><div align=\"left\" style=\"width: 20em\">" + dep + "</div><div align=\"left\" style=\"width: 20em\">" + dest + "</div><div align=\"left\" style=\"width: 20em\">Altitude_" + alt + "</div><div align=\"left\" style=\"width: 20em\">" + gs +"</div>")

 

and he written xml file (just to prove im not mad...)

 

<?xml version="1.0" encoding="ISO-8859-1"?>
<markers>

<marker lng="-2.42547666667" lat="50.749275" title="Dave Giffney" hub="" ivao="194743" text="UKC001" dep="EGTE" dest="EGTE" status="Boarding" statusalt="Ground" curwp="EGTE" flown="0" planned="0" airline="Cougar Virtual" flightno="CVV" aircraft="Experimental" pass="" cargo="" alt="103" hdg="82" ias="0" tas="0" pause="OK" type="black" />

</markers>

 

Thanks in advance....

 

 

Link to comment
https://forums.phpfreaks.com/topic/41306-solved-java-and-xml/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.