Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
// Read the data from example.xml
downloadUrl(BASE_PATH+"ajax/getmapxmldata.php?show="+show+"&pagenum="+pagenum+"&property_type="+property_type+"&property_price_start_range="+property_price_start_range+"&property_price_end_range="+property_price_end_range+"&property_living_area_start_range="+property_living_area_start_range+"&property_living_area_end_range="+property_living_area_end_range+"&property_location="+property_location+"&property_location_subarea="+property_location_subarea+"&property_specification_view="+property_specification_view+"&property_specification_luxury="+property_specification_luxury+"&property_specification_largelot="+property_specification_largelot+"&property_specification_bedrooms="+property_specification_bedrooms+"&property_specification_bathrooms="+property_specification_bathrooms+"&property_specification_age="+property_specification_age+"&property_specification_sortby="+property_specification_sortby+"",
function(doc) {
alert(doc);
var xmlDoc = xmlParse(doc);
var markers = xmlDoc.documentElement.getElementsByTagName("marker");

iam geting error on underline
Posted
Comments
Yvan Rodrigues 20-Aug-14 9:57am    
What JS library are you using for xmlParse()?
It would appear that xmlDoc is not a valid XML document. Examine it in the debugger. Perhaps the XML that is generated is invalid.
Vikrant Chauhan 22-Aug-14 1:40am    
this library iam using

/**
* Returns an XMLHttp instance to use for asynchronous
* downloading. This method will never throw an exception, but will
* return NULL if the browser does not support XmlHttp for any reason.
* @return {XMLHttpRequest|Null}
*/
function createXmlHttpRequest() {
try {
if (typeof ActiveXObject != 'undefined') {
return new ActiveXObject('Microsoft.XMLHTTP');
} else if (window["XMLHttpRequest"]) {
return new XMLHttpRequest();
}
} catch (e) {
changeStatus(e);
}
return null;
};

/**
* This functions wraps XMLHttpRequest open/send function.
* It lets you specify a URL and will call the callback if
* it gets a status code of 200.
* @param {String} url The URL to retrieve
* @param {Function} callback The function to call once retrieved.
*/
function downloadUrl(url, callback) {
var status = -1;
var request = createXmlHttpRequest();
if (!request) {
return false;
}

request.onreadystatechange = function() {
if (request.readyState == 4) {
try {
status = request.status;
} catch (e) {
// Usually indicates request timed out in FF.
}
if ((status == 200) || (status == 0)) {
callback(request.responseText, request.status);
request.onreadystatechange = function() {};
}
}
}
request.open('GET', url, true);
try {
request.send(null);
} catch (e) {
changeStatus(e);
}
};

/**
* Parses the given XML string and returns the parsed document in a
* DOM data structure. This function will return an empty DOM node if
* XML parsing is not supported in this browser.
* @param {string} str XML string.
* @return {Element|Document} DOM.
*/
function xmlParse(str) {
if (typeof ActiveXObject != 'undefined' && typeof GetObject != 'undefined') {
var doc = new ActiveXObject('Microsoft.XMLDOM');
doc.loadXML(str);
return doc;
}

if (typeof DOMParser != 'undefined') {
return (new DOMParser()).parseFromString(str, 'text/xml');
}

return createElement('div', null);
}

/**
* Appends a JavaScript file to the page.
* @param {string} url
*/
function downloadScript(url) {
var script = document.createElement('script');
script.src = url;
document.body.appendChild(script);
}
Neetin_1809 20-Aug-14 10:06am    
can you elobarate your Question?
Vikrant Chauhan 22-Aug-14 1:43am    
yeah sure, actually iam getting data in the form of xml from ajax file to show it on the google map as markers.it is working fine in chrome and firefox but not in ie ,somtimes it works and there is another error comes all the time it says
'dx' is null or not an object
Sergey Alexandrovich Kryukov 20-Aug-14 11:25am    
Yes, how do you know that doc was successfully parsed? You need to check for that first.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900