<% Option Explicit '************************************* ' Author: Shaun Brazier of Smart-Quotes Ltd ' Purpose: Weather XML usign a BBC Type Feed ' Date Modified: 3rd May 2006 '************************************* 'Lets set up an array for the Towns (This is a Database incode) 'rows,cols Dim arrTowns(7,1) arrTowns(0,0) = "3753" arrTowns(0,1) = "Newquay" arrTowns(1,0) = "1184" arrTowns(1,1) = "Bournemouth" arrTowns(2,0) = "0339" arrTowns(2,1) = "Isle of Wight" arrTowns(3,0) = "1895" arrTowns(3,1) = "Bude" arrTowns(4,0) = "3106" arrTowns(4,1) = "Plymouth" arrTowns(5,0) = "1000" arrTowns(5,1) = "Aberdeen" arrTowns(6,0) = "0287" arrTowns(6,1) = "Gold Coast Queensland-Australia" arrTowns(7,0) = "0094" arrTowns(7,1) = "Bells Beach, Victoria Australia" 'Declare Variables Dim objXML,objLst,intNoOfElements, i,objHdl,strDirectoryText, intTownSelect intTownSelect = Request.Form("TownSelect") If intTownSelect = "" Then intTownSelect = 3753 '3753 is Newquay - Our Default is Newquay 'Create the XML Object Set objXML = Server.CreateObject("Microsoft.XMLDOM") Set objLst = Server.CreateObject("Microsoft.XMLDOM") objXML.async = false objXML.setProperty "ServerHTTPRequest", true 'Put here the URL of the XML you want to reference - THis is available from the XML section of the login 'objXML.Load ("http://www.mopoke.co.uk/weather/3753.xml") Select Case intTownSelect Case 0339, 0287, 0094 objXML.Load ("http://www.mopoke.co.uk/weather/world/" & intTownSelect & ".xml") Case Else objXML.Load ("http://www.mopoke.co.uk/weather/" & intTownSelect & ".xml") End Select 'If intTownSelect = 0339 Then ' objXML.Load ("http://www.mopoke.co.uk/weather/world/" & intTownSelect & ".xml") 'Else ' objXML.Load ("http://www.mopoke.co.uk/weather/" & intTownSelect & ".xml") 'End If 'You could use MSXML Version 3 or 4 but it does depend what version you have on the server. 'Set objXML = Server.CreateObject("Msxml2.DomDocument.3.0") 'Set objLst = Server.CreateObject("Msxml2.DomDocument.3.0") 'Here you reference the ROW Element - This where we want to get our data from Set objLst = objXML.getElementsByTagName("item") intNoOfElements = objLst.length %> Weather Forecast
: : home : : the clothes » : : accessories : : what else do we do? » : : get in touch »
<% 'Loop through each ROW eleement to display data For i = 0 To (intNoOfElements-1) Set objHdl = objLst.item(i) 'Ok First Lets use Instr to find out where thw word max is Dim intMaxInStr, intMaxTemp, strClothingType, strClothingText intMaxInStr = inStr(objHdl.childNodes(2).text,"Max") 'Response.Write(intMaxInStr) 'Now lets find out what the Max Temperature is intMaxTemp = Mid(objHdl.childNodes(2).text,intMaxInStr + 5,2) 'Response.Write intMaxTemp 'What clothing should they wear Dim strClothingTextMens,strClothingTextWomens,strClothingTypeMens,strClothingTypeWomens strClothingTextMens = "Blokes" strClothingTextWomens = "Girls" Select Case intMaxTemp Case "1C","2C","3C","4C","5C","6C","7C","8C","9C" strClothingTypeMens = "http://www.fukwit.co.uk/menswear2.html" strClothingTypeWomens = "http://www.fukwit.co.uk/womenswear4.html" 'strClothingText = "Need to stay Warm, but look cool then check out these Fukwit ideas" Case "10","11","12","13","14" strClothingTypeMens = "http://www.fukwit.co.uk/menswear3.html" strClothingTypeWomens = "http://www.fukwit.co.uk/womenswear3.html" 'strClothingText = "It ain't gonna be too cold. Check out what you should be wearing" Case Else strClothingTypeMens = "http://www.fukwit.co.uk/menswear.html" strClothingTypeWomens = "http://www.fukwit.co.uk/womenswear.html" 'strClothingText = "Look cool and stay cool - Check out the selection" End Select Response.Write "" 'This will Display the Day Response.Write "" 'This will Display Weather Description Response.Write "" 'This will Display What clothes i shall wear link Response.Write "" 'This will Dispaly more details link Response.Write "" 'This will Display Directory Text 'response.Write "" Next 'Now we need to add disclaimer text. This is very important and must always be present Response.Write "" Response.Write "" Response.Write "" %>
" 'We no longer want to use the item eleement - we now want to get the data from the channel element Set objLst = objXML.getElementsByTagName("channel") Set objHdl = objLst.item(0) 'Write out Powered by Message and disclaimer Response.Write(objHdl.childNodes(2).text & ".
" & objHdl.childNodes(4).text & ". " &"
" & "Powered By: " & objHdl.childNodes(7).text ) Response.Write "
fukwit © all rights reserved
fukwit homepage>>