Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. LINQ
  4. LINQ to HTML/XML C#

LINQ to HTML/XML C#

Scheduled Pinned Locked Moved LINQ
csharphtmllinqcomxml
2 Posts 2 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    faheemnadeem
    wrote on last edited by
    #1

    Hi all, I have come to problem, which i am unable to find a solution... I need to parse a RSS document (containing as always some XML and some HTML) using LINQ The document is web response from yahoo weather feeds, given below.

    <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84\_pos#">
    <channel>

    <title>Yahoo! Weather - Islamabad, PK</title>
    <link>http://us.rd.yahoo.com/dailynews/rss/weather/Islamabad\_\_PK/\*http://weather.yahoo.com/forecast/PKXX0006\_c.html</link>
    <description>Yahoo! Weather for Islamabad, PK</description>
    <language>en-us</language>
    <lastBuildDate>Mon, 15 Feb 2010 6:55 am PKT</lastBuildDate>
    <ttl>60</ttl>
    <yweather:location city="Islamabad" region="" country="Pakistan"/>
    <yweather:units temperature="C" distance="km" pressure="mb" speed="km/h"/>
    <yweather:wind chill="5" direction="50" speed="19.31" />
    <yweather:atmosphere humidity="76" visibility="4.01" pressure="982.05" rising="0" />
    <yweather:astronomy sunrise="6:52 am" sunset="5:51 pm"/>
    <image>
    <title>Yahoo! Weather</title>
    <width>142</width>
    <height>18</height>
    <link>http://weather.yahoo.com</link>
    <url>http://l.yimg.com/a/i/us/nws/th/main\_142b.gif</url>
    </image>
    <item>
    <title>Conditions for Islamabad, PK at 6:55 am PKT</title>
    geo:lat33.71</geo:lat>
    geo:long73.08</geo:long>
    <link>http://us.rd.yahoo.com/dailynews/rss/weather/Islamabad\_\_PK/\*http://weather.yahoo.com/forecast/PKXX0006\_c.html</link>
    <pubDate>Mon, 15 Feb 2010 6:55 am PKT</pubDate>
    <yweather:condition text="Haze" code="21" temp="8" date="Mon, 15 Feb 2010 6:55 am PKT" />
    <description><![CDATA[

    <img src="http://l.yimg.com/a/i/us/we/52/21.gif"/><br />
    <b>Current Conditions:</b><br />
    Haze, 8 C<BR />
    <BR /><b>Forecast:</b><BR />
    Mon - Rain. High: 14 Low: 4<br />
    Tue - PM Showers. High: 17 Low: 6<br />
    <br />
    <a href="http://us.rd.yahoo.com/dailynews/rss/weather/Islamabad\_\_PK/\*http://weather.yahoo.com/forecast/PKXX0006\_c.html">Full Forecast at Yahoo! Weather</a><BR/><BR/>
    (provided by <a href="http://www.weather.com" >The Weather Channel</a>

    D 1 Reply Last reply
    0
    • F faheemnadeem

      Hi all, I have come to problem, which i am unable to find a solution... I need to parse a RSS document (containing as always some XML and some HTML) using LINQ The document is web response from yahoo weather feeds, given below.

      <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84\_pos#">
      <channel>

      <title>Yahoo! Weather - Islamabad, PK</title>
      <link>http://us.rd.yahoo.com/dailynews/rss/weather/Islamabad\_\_PK/\*http://weather.yahoo.com/forecast/PKXX0006\_c.html</link>
      <description>Yahoo! Weather for Islamabad, PK</description>
      <language>en-us</language>
      <lastBuildDate>Mon, 15 Feb 2010 6:55 am PKT</lastBuildDate>
      <ttl>60</ttl>
      <yweather:location city="Islamabad" region="" country="Pakistan"/>
      <yweather:units temperature="C" distance="km" pressure="mb" speed="km/h"/>
      <yweather:wind chill="5" direction="50" speed="19.31" />
      <yweather:atmosphere humidity="76" visibility="4.01" pressure="982.05" rising="0" />
      <yweather:astronomy sunrise="6:52 am" sunset="5:51 pm"/>
      <image>
      <title>Yahoo! Weather</title>
      <width>142</width>
      <height>18</height>
      <link>http://weather.yahoo.com</link>
      <url>http://l.yimg.com/a/i/us/nws/th/main\_142b.gif</url>
      </image>
      <item>
      <title>Conditions for Islamabad, PK at 6:55 am PKT</title>
      geo:lat33.71</geo:lat>
      geo:long73.08</geo:long>
      <link>http://us.rd.yahoo.com/dailynews/rss/weather/Islamabad\_\_PK/\*http://weather.yahoo.com/forecast/PKXX0006\_c.html</link>
      <pubDate>Mon, 15 Feb 2010 6:55 am PKT</pubDate>
      <yweather:condition text="Haze" code="21" temp="8" date="Mon, 15 Feb 2010 6:55 am PKT" />
      <description><![CDATA[

      <img src="http://l.yimg.com/a/i/us/we/52/21.gif"/><br />
      <b>Current Conditions:</b><br />
      Haze, 8 C<BR />
      <BR /><b>Forecast:</b><BR />
      Mon - Rain. High: 14 Low: 4<br />
      Tue - PM Showers. High: 17 Low: 6<br />
      <br />
      <a href="http://us.rd.yahoo.com/dailynews/rss/weather/Islamabad\_\_PK/\*http://weather.yahoo.com/forecast/PKXX0006\_c.html">Full Forecast at Yahoo! Weather</a><BR/><BR/>
      (provided by <a href="http://www.weather.com" >The Weather Channel</a>

      D Offline
      D Offline
      Dan Mos
      wrote on last edited by
      #2

      I'm just stating the obvious but there is [EDIT] no [/EDit] XLINQ method to get "nodes" inside a XCDATA.Just the value/text wich is everything inside the XCData. You have to manually set up a routine to extract the needed data(s). Wich can be quite easy if all you ever need to get is the <img src="...".

      modified on Tuesday, February 16, 2010 10:29 PM

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups