像下面的节点我怎么读出url的值来
<media:thumbnail url="http://static.flickr.com/106/251336449_ddbc6aadf3_s.jpg" height="75" width="75" />我现在只能读下面这个节点一样的东西
<title>Luly Yang Couture</title>
<media:thumbnail url="http://static.flickr.com/106/251336449_ddbc6aadf3_s.jpg" height="75" width="75" />我现在只能读下面这个节点一样的东西
<title>Luly Yang Couture</title>
xmlDoc.LoadXml("<media:thumbnail url=\"http://static.flickr.com/106/251336449_ddbc6aadf3_s.jpg\" height=\"75\" width=\"75\" xmlns:media='http://dotnet.aspx.cc/'/>");
System.Xml.XmlNamespaceManager nr = new XmlNamespaceManager(xmlDoc.NameTable);nr.AddNamespace("media", "http://dotnet.aspx.cc/");
XmlNode n = xmlDoc.SelectSingleNode("/media:thumbnail/@url", nr);
Response.Write(n.Value);
到底应该怎么做
{
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load("http://api.flickr.com/services/feeds/photos_public.gne?id=44124424463@N01&format=rss_200"); System.Xml.XmlNamespaceManager nr = new System.Xml.XmlNamespaceManager(doc.NameTable);
nr.AddNamespace("mxh", "http://search.yahoo.com/mrss");
System.Xml.XmlNodeList ns = doc.SelectNodes("/rss/channel/item/mxh:content", nr);
foreach (System.Xml.XmlNode n in ns)
{
Response.Write("<br><img src='" + n.Attributes["url"].Value + "' width='" + n.Attributes["width"].Value + "' height='" + n.Attributes["height"].Value + "'>");
}
}
</script>
{
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load("http://api.flickr.com/services/feeds/photos_public.gne?id=44124424463@N01&format=rss_200"); System.Xml.XmlNamespaceManager nr = new System.Xml.XmlNamespaceManager(doc.NameTable);
nr.AddNamespace("mxh", "http://search.yahoo.com/mrss");
System.Xml.XmlNodeList ns = doc.SelectNodes("/rss/channel/item/mxh:content", nr);
int i = 1;
Response.Write("<table><tr>");
foreach (System.Xml.XmlNode n in ns)
{
Response.Write("<td><img src='" + n.Attributes["url"].Value + "' width='" + n.Attributes["width"].Value + "' height='" + n.Attributes["height"].Value + "'></td>");
if(i == 3)
{
Response.Write("</tr><tr>");
}
i++;
if(i>6) break;
}
Response.Write("</tr></table>");
}
</script>