Home All Groups Group Topic Archive Search About

How to solve this " problem

Author
9 Jun 2005 8:51 PM
Shapper
Hello,

I am accessing a value in a XML value:
  news.Load(Server.MapPath("xml/ news.rss"))
  newslabel.Text = CType(news.SelectSingleNode("rss version="2.0
"/channel/title").InnerText, String)

The XML file:

<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>News</title>
    <description>...</description>
    <item>
      <title>...</title>
      <description>...</description>
    </item>
    ...
  </channel>
</rss>

If I take the <rss version="2.0"> and use:
  newslabel.Text =
CType(news.SelectSingleNode("channel/title").InnerText, String)

Can you tell me how to solve this? The problem is in my node path when I
have ("rss version=&quot;2.0&quot;/channel/title")

I used =&quot; instead of " to try to fix the problem but it didn't
work.

Thanks,
Miguel

Author
10 Jun 2005 7:36 AM
Hans Kesting
Shapper wrote:
Show quoteHide quote
> Hello,
>
> I am accessing a value in a XML value:
>  news.Load(Server.MapPath("xml/ news.rss"))
>  newslabel.Text = CType(news.SelectSingleNode("rss version=&quot;2.0
> &quot;/channel/title").InnerText, String)
>
> The XML file:
>
> <?xml version="1.0"?>
> <rss version="2.0">
>  <channel>
>    <title>News</title>
>    <description>...</description>
>    <item>
>      <title>...</title>
>      <description>...</description>
>    </item>
>    ...
>  </channel>
> </rss>
>
> If I take the <rss version="2.0"> and use:
>  newslabel.Text =
> CType(news.SelectSingleNode("channel/title").InnerText, String)
>
> Can you tell me how to solve this? The problem is in my node path
> when I have ("rss version=&quot;2.0&quot;/channel/title")
>
> I used =&quot; instead of " to try to fix the problem but it didn't
> work.
>
> Thanks,
> Miguel

use

  SelectSingleNode("/rss[@version='2.0']/channel/title")

or just

  SelectSingleNode("/rss/channel/title")


Hans Kesting

Bookmark and Share