Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GetWeatherFeed("97229", "//weather//loc//dnam", "//weather//cc//tmp", "/weather/cc/icon");
- System.Xml.XmlTextReader xtr = new System.Xml.XmlTextReader(Url that retuns xm);
- System.Collections.Hashtable ht = new System.Collections.Hashtable();
- ht = FindTagsUsingXPthNaviatorAndXPathDocumentNew(xtr, location, temperature, iconid);
- lblLocation.Content = ht["Location"].ToString();
- lblWeatherCondition.Content = ht["Weather"].ToString();
- public System.Collections.Hashtable FindTagsUsingXPthNaviatorAndXPathDocumentNew(System.Xml.XmlTextReader xtr, string nodeToLocate1, string nodeToLocate2, string nodeToLocate3)
- {
- System.Xml.XPath.XPathDocument xpDoc = new System.Xml.XPath.XPathDocument(xtr);
- System.Xml.XPath.XPathNavigator xpNav = xpDoc.CreateNavigator();
- System.Xml.XPath.XPathExpression xpExpression = xpNav.Compile(nodeToLocate1);
- System.Xml.XPath.XPathNodeIterator xpIter = xpNav.Select(xpExpression);
- System.Collections.Hashtable ht = new System.Collections.Hashtable();
- while (xpIter.MoveNext())
- {
- ht.Add("Location", xpIter.Current.Value);
- }
- xpExpression = xpNav.Compile(nodeToLocate2);
- xpIter = xpNav.Select(xpExpression);
- while (xpIter.MoveNext())
- {
- ht.Add("Weather", xpIter.Current.Value);
- }
- xpExpression = xpNav.Compile(nodeToLocate3);
- xpIter = xpNav.Select(xpExpression);
- while (xpIter.MoveNext())
- {
- ht.Add("Icon", xpIter.Current.Value);
- }
- return ht;
- }
- System.Xml.XmlTextReader xtr = new System.Xml.XmlTextReader(my xml url);
- System.Xml.XPath.XPathDocument xdoc = new System.Xml.XPath.XPathDocument(xtr);
- lblLocation.Content = getXmlNodeValue(xdoc, location);
- lblWeatherCondition.Content = getXmlNodeValue(xdoc, temperature);
Add Comment
Please, Sign In to add comment