p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 3.5 Professionals (http://p2p.wrox.com/forumdisplay.php?f=352)
-   -   Loading XML file (http://p2p.wrox.com/showthread.php?t=81534)

phuchoang2583 November 10th, 2010 06:33 AM

Loading XML file
 
Hello everybody
I have taken more hours to do this
but it is not work, i want to try to get ID from datbase
This is my code

function createMarker(point, index, html)
{
// var letter = String.fromCharCode("A".charCodeAt(0) + index);
var letteredIcon = new GIcon(icon0);
var geticon=new GIcon(baseIcon);
var ID= <%=GetHotelID %>; // get ID from database
ID=parseInt(ID);
var locations = xmlDoc.documentElement.getElementsByTagName("locat ion");
var m;
var hotelids = xmlDoc.getElementsByTagName("hotelid");
var hnames = xmlDoc.getElementsByTagName("hname");
for (m=0;m<locations.length;m=m+1)
{

var hotelid = parseInt(hotelids[m].firstChild.nodeValue);
var hotelname = hnames[m].firstChild.nodeValue;
alert(hotelid +'=' + ID ) ;
if (hotelid=ID) //compare hotelid with ID to appeare
{
var marker = new GMarker(point, letteredIcon);
}
else
{
var marker = new GMarker(point, geticon);
}
}
GEvent.addListener(marker, "mouseover", function()
{ marker.openInfoWindowHtml(html); }
);
markerList[index] = {marker:marker, html:html};
return marker;

}
================
XML File
<locations>

<location>
<hotelid>1</hotelid>
<MapName>Novotel Hotel Nha Trang</MapName>
<hname>novotel Nha trang</hname>
<provincename>Nha Trang</provincename>
<himage>True</himage>
<Latitude>12.2376877047603</Latitude>
<Longitude>109.196698665619</Longitude>
</location>

<location>
<hotelid>2</hotelid>
<MapName>Yasaka</MapName>
<hname>Yasaka Saigon Nha Trang</hname>
<provincename>Nha Trang</provincename>
<himage>True</himage>
<Latitude>12.2490637295063</Latitude>
<Longitude>109.196248054504</Longitude>
</location>

<location>
<hotelid>6</hotelid>
<MapName>Sunrise Hotel</MapName>
<hname>Sunrise Hotel</hname>
<provincename>Nha Trang</provincename>
<himage>True</himage>
<Latitude>12.2508041656292</Latitude>
<Longitude>109.196194410324</Longitude>
</location>

<location>
<hotelid>7</hotelid>
<MapName>Diamond Bay Resort</MapName>
<hname>Diamond Bay Resort and Golf</hname>
<provincename>Nha Trang</provincename>
<himage>True</himage>
<Latitude>12.1700715221296</Latitude>
<Longitude>109.190883636475</Longitude>
</location>
</locations>
Thanks in advance

phuchoang2583 November 17th, 2010 05:33 AM

I think i have found out it


All times are GMT -4. The time now is 12:11 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.