<%@Page Language="C#"%>
<%@Import Namespace="System.Net"%>
<%@Import Namespace="System.IO"%>
<%@Import Namespace="System.Xml.XPath"%>
<%@Import Namespace="System.Xml"%>
<%
Response.Clear();
Response.ContentType = "text/html";
WebClient wc = new WebClient();
Stream str = wc.OpenRead(
"http://ws.audioscrobbler.com/rdf/history/fumiakiy");
XPathDocument doc = new XPathDocument(str);
str.Close();
XPathNavigator nav = doc.CreateNavigator();
XPathExpression expr =
nav.Compile("//rss:item/rss:link");
XmlNamespaceManager nsm =
new XmlNamespaceManager(nav.NameTable);
nsm.AddNamespace("rss", "http://purl.org/rss/1.0/");
expr.SetContext(nsm);
XPathNodeIterator links = nav.Select(expr);
Response.Write("document.write('");
Response.Write("<ul>");
while (links.MoveNext()) {
XPathNavigator cur = links.Current;
string link = cur.Value;
cur.MoveToNext();
string description = cur.Value;
Response.Write("<li><a href=\"" +
link + "\">" + description + "</a></li>");
}
Response.Write("</ul>");
Response.Write("')");
Response.End();
%>
んでもってこれを
<script type="text/javascript" src="http://your_url/thiscode.aspx"/>
みたいに貼る。以上。
0 件のコメント:
コメントを投稿