public string getLocationData(string zipcode) { string zURL = string.Format("http://maps.googleapis.com/maps/api/geocode/xml?address={0}", zipcode); WebRequest request_location = WebRequest.Create(zURL); Stream locationStream = request_location.GetResponse().GetResponseStream(); MyXMLParser locationParser = new MyXMLParser(locationStream); return locationParser.getLocationData(); }
public double getSolarIntensity(double lat, double lon) { string sURL = string.Format("https://developer.nrel.gov/api/solar/solar_resource/v1.xml?api_key=3e2vJlG6bRBWFQeFzwbYZFIYfDoU6Fk2XqhfoWeP&lat={0}&lon={1}", lat, lon); WebRequest request_solar = WebRequest.Create(sURL); Stream solarStream; solarStream = request_solar.GetResponse().GetResponseStream(); MyXMLParser myParser = new MyXMLParser(solarStream); return myParser.getAverageIntensity(); }
public Tuple<double, double> getLatLong(string zipcode) { // Convert the zip code into a latitude and logitide pair using the Google Geocode API. string zURL = string.Format("http://maps.googleapis.com/maps/api/geocode/xml?address={0}", zipcode); WebRequest request_latlong = WebRequest.Create(zURL); Stream latLongStream = request_latlong.GetResponse().GetResponseStream(); MyXMLParser zipcodeParser = new MyXMLParser(latLongStream); double lat = zipcodeParser.getLatitude(); double lon = zipcodeParser.getLongitude(); return new Tuple<double,double>(lat, lon); }
public void exportXML_test() { XElement expected = XElement.Load(@"..\..\..\..\Data\sample_output_enwiki-latest-pages-articles1_Test_example.xml"); Console.WriteLine(expected.ToString()); String inputPath = @"..\..\..\..\Data\sample_input_enwiki-latest-pages-articles1.xml"; String exportPath = @"..\..\..\..\Data\sample_output_enwiki-latest-pages-articles1_unit_test.xml"; MyXMLParser control = new MyXMLParser(); control.initParsing(inputPath); control.exportEventsXML(exportPath); Console.WriteLine(control.getXmlString()); Assert.AreEqual(expected.ToString(), control.getXmlString()); //XElement actual = testClass.exportXML(); }