How to solve this " problem

S

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
 
H

Hans Kesting

Shapper said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,150
Members
46,697
Latest member
AugustNabo

Latest Threads

Top