private void btnSaveData_Click(object sender, EventArgs e) { //HtmlDocument doc = webBrowser1.Document; //HtmlElement elem = doc.GetElementsByTagName("NewDataSet")[0]; //string content = elem.InnerHtml; //XmlDocument doc1 = new XmlDocument(); //doc1.LoadXml(webBrowser1.DocumentText.ToString().Replace(" ", " ")); // doc1.LoadXml(content); //Save the document to a file. //doc1.Save(@"C:\Users\Pale\Desktop\GetInfoByZIP.xml"); //string path = @"C:\Users\Pale\Desktop\GetInfoByZIP.xml"; // string path = webBrowser1.Url.ToString(); //WebClient client = new WebClient(); //string downloadString = client.DownloadString(path); //File.WriteAllText("C:/Users/GetInfoByZIP.xml", downloadString); webBrowser1.ShowSaveAsDialog(); string path = @"C:\Users\jwheetley\Desktop\GetInfoByZIP.xml"; MessageBox.Show(path); XmlReaderSettings settings = new XmlReaderSettings(); settings.IgnoreWhitespace = true; settings.IgnoreComments = true; XmlReader reader = XmlReader.Create(path, settings); if (reader.ReadToDescendant("Table")) { reader.ReadStartElement("Table"); string strCity = reader.ReadElementContentAsString(); // reader.ReadToDescendant("STATE"); string strState = reader.ReadElementContentAsString(); // reader.ReadToDescendant("ZIP"); int intZip = reader.ReadElementContentAsInt(); // reader.ReadToDescendant("AREA_CODE"); int intAreaCode = reader.ReadElementContentAsInt(); // reader.ReadToDescendant("TIME_ZONE"); string strTimeZone = reader.ReadElementContentAsString(); ZipCode zipCode = new ZipCode { City = strCity, State = strState, ZipC = intZip, AreaCode = intAreaCode, TimeZone = strTimeZone }; ZipCodeDB.AddZipInfo(zipCode); Close(); } }