佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 813|回复: 1

关于RSS在.NET的用途...

[复制链接]
发表于 6-9-2006 11:50 AM | 显示全部楼层 |阅读模式
http://partner.dw-world.de/syndication/feeds/ahk-singapur.507.xml

以上是LIVE的RSS SEED, 如果我想要从上面的LINK拿到然后DISPLAY在
我的PAGE, 要怎样做呢? 谁能帮帮我

对了,我是用ASP.NET(C#)的,
我是有找到一个SAMPLE CODE, 但有ERROR,

string strXmlSrc = "http://partner.dw-world.de/syndication/feeds/ahk-singapur.507.xml";

string strXslFile = Server.MapPath("megatokyo.xsl";

                       
// Load our XML file into the XmlDocument object.
XmlDocument myXmlDoc = new XmlDocument();
myXmlDoc.Load(strXmlSrc);

// Load our XSL file into the XslTransform object.
XslTransform myXslDoc= new XslTransform();
myXslDoc.Load(strXslFile);

// Create a StringBuilder and then point a StringWriter at it.
// We'll use this to hold the HTML output by the Transform method.
StringBuilder myStringBuilder = new StringBuilder();
StringWriter myStringWriter = new StringWriter(myStringBuilder);

// Call the Transform method of the XslTransform object passing it
// our input via the XmlDocument and getting output via the StringWriter.
myXslDoc.Transform(myXmlDoc, null, myStringWriter);

// Since I've got the page set to cache, I tag on a little
// footer indicating when the page was actually built.
myStringBuilder.Append("<br><p><em>Cached at: " + DateTime.Now + "</em></p><br>";

// Take our resulting HTML and display it via an ASP.NET
// literal control.
RssHtml.Text = myStringBuilder.ToString();
               
ERROR MESSAGE是:
The underlying connection was closed: An unexpected error occurred on a receive.

Line 124:        // Load our XML file into the XmlDocument object.
Line 125:        XmlDocument myXmlDoc = new XmlDocument();
Line 126:        myXmlDoc.Load(strXmlSrc);
Line 127:
Line 128:        // Load our XSL file into the XslTransform object.
回复

使用道具 举报


ADVERTISEMENT

发表于 9-9-2006 12:17 PM | 显示全部楼层
这是Load不到网络上的XML文件,
你RUN这程序时,需要有Internet access,
才可以读取那XML文件
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 12-11-2024 07:47 AM , Processed in 0.101391 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表