Value20%
Due Date: 5pm 4 October 2004
The Australian Bureau of Meteorology has a number of automatic weather
stations located in Victoria. The hourly observations from the
weather stations are are recorded into a plain text file ( ref. no. IDY03023 ). The document is available from the
Bureau's Web page : " Latest
Observations from Victoria (hourly update)" .
The following information is used to extract the data from the fields of the IDY03023 report.
station = substring(0,12);
latitude = substring(12,14)+"."+strLine.substring(14,16);
longitude = substring(17,20)+"."+strLine.substring(20,22);
day = substring(22,26);
time = substring(26,30);
windDir = substring(37,40);
windSpeedKnot = substring(41,45);
tempC = substring(45,47);
relHumidity = substring(48,50);
barPressurehPa = substring(51,59);
rain = substring(59,62);
rainPeriodValue = substring(63,65);
weather = substring(67,71);
Modify the Java programs from Web Services - Lab 06 to obtain a copy of the data file and extract the data fields into an XML document.
You can read from a remote file using http in a java program by using the URL & HttpURLConnection classes as follows:
import java.net.*;
import java.io.*;
import java.util.Properties;
..
BufferedReader in;
..
Properties properties = System.getProperties();
properties.put("http.proxyHost", "proxy.latrobe.edu.au");
properties.put("http.proxyPort", "8080");
String url = "http://www.bom.gov.au/cgi-bin/wrap_fwo.pl?IDY03023.txt";
try{
URL infileURL = new URL( url );
HttpURLConnection connection=
(HttpURLConnection)(infileURL.openConnection());
in = new BufferedReader(new InputStreamReader(connection.getInputStream()))
// use in.readLine() as usual to read in a line of text
// use subtring() method of String to extract individual fields
..Design a single XSL style sheet that uses java.org.apache.xalan.xslt.Process to
perform all the following transformations to produce an HTML document:
If you wish to try this at home you will need to download xerces and xalan from http://www.apache.org/ and install the packages into your java ext folder.