CoolBreeze812 Posted June 6, 2007 Posted June 6, 2007 (edited) I'm still learning to parse .XML in .NET and I'm having a problem where I'm receiving the following error and I can't figure it out, so any help would be greatly appreciated. "Illegal characters in path" The XML being returned is as follows: [highlight=xml] <?xml version="1.0" encoding="utf-8" ?> <string xmlns="http://www.webserviceX.NET"> <?xml version="1.0" encoding="utf-16"?> <CurrentWeather> <Location>Newark, Newark Heath Airport, OH, United States (KVTA) 40-01-22N 082-27-45W 268M</Location> <Time>Jun 05, 2007 - 08:54 PM EDT / 2007.06.06 0054 UTC</Time> <Wind> from the N (350 degrees) at 3 MPH (3 KT):0</Wind> <Visibility> 10 mile(s):0</Visibility> <SkyConditions> clear</SkyConditions> <Temperature> 62.1 F (16.7 C)</Temperature> <DewPoint> 53.1 F (11.7 C)</DewPoint> <RelativeHumidity> 72%</RelativeHumidity> <Pressure> 29.77 in. Hg (1008 hPa)</Pressure> <Status>Success</Status> </CurrentWeather> </string> [/highlight] d dHere is how I am retrieving the XML. string result; globalWeatherWS.GlobalWeather gw = new globalWeatherWS.GlobalWeather(); result = gw.GetWeather("newark", "united states"); XPathDocument doc = new XPathDocument(result); XPathNavigator nav = doc.CreateNavigator(); XPathExpression expr; expr = nav.Compile("CurrentWeather"); XPathNodeIterator iterator = nav.Select(expr); while (iterator.MoveNext()) { XPathNavigator nav2 = iterator.Current.Clone(); textBox1.Text = nav2.Value; } Edited June 6, 2007 by PlausiblyDamp Quote
Administrators PlausiblyDamp Posted June 6, 2007 Administrators Posted June 6, 2007 First thing I notice is that this document contains two Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
CoolBreeze812 Posted June 6, 2007 Author Posted June 6, 2007 Thanks for the reply. I noticed that to; however, this is what is returned by the web service. I was able to solve the problem, though by taking a different approach to parsing the returned XML data. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.