How to solve the colon reading problem in XML

Source: Internet
Author: User

Reference Article : Http://chs.gotdotnet.com/quickstart/howto/doc/Xml/XmlNameSpace.aspx

Even source code:
Public void bindxml (string xmlurl)
{
System. xml. xmldocument Doc = new system. xml. xmldocument ();
Doc. Load (system. appdomain. currentdomain. basedirectory + "kkjj. xml ");
// Doc. Load (xmlurl );
Doc. selectnodes ("/RSS/channel ");
System. xml. xmlnode root = Doc. documentelement;
System. xml. xmlnode xn = root. selectsinglenode ("/RSS/channel ");
Outstr + = "album name:" + Xn. selectsinglenode ("title"). innertext; // album name
Outstr + = "<br> album URL:" + Xn. selectsinglenode ("Link"). innertext; // album URL
Outstr + = "<br> album image:

// Outstr + = "<br> ";
System. xml. xmlnodelist xnl = xn. selectnodes ("item ");
Outstr + = "<br> Number of album images:" + xnl. Count. tostring () + "Zhang ";

System. xml. xmlnamespacemanager nsmanager = new system. xml. xmlnamespacemanager (Doc. nametable );
Nsmanager. addnamespace ("Media", "http://search.yahoo.com/mrss ");

// Create a string containing the XPath expression for calculation.
String exprstring = string. Format ("// {0}: Group", "Media ");

System. xml. xmlnodelist nodelist = Doc. selectnodes (exprstring, nsmanager );

Outstr + = "<br> media: title:" + nodelist [0]. selectsinglenode ("Media: Title", nsmanager). attributes ["type"]. innertext;

// For (INT I = 0; I <xnl. Count; I ++)
//{
// Outstr + = "<br> ";
//}
}

At that time, I saw it .. Gg's XML contains a colon, and Kaka solves the problem ..
Add XML snippets

-<Media: group>
<Media: Title type = "plain"> 02.jpg</media: title>
<Media: description type = "plain"/>
<Media: keywords/>
<Media: thumbnail url = "http://lh3.google.com/pengpengsay/R3C96dqJBUI/AAAAAAAAAEo/j3csPO0ig7o/s72/02.JPG" Height = "48" width = "72"/>
<Media: thumbnail url = "http://lh3.google.com/pengpengsay/R3C96dqJBUI/AAAAAAAAAEo/j3csPO0ig7o/s144/02.JPG" Height = "96" width = "144"/>
<Media: thumbnail url = "http://lh3.google.com/pengpengsay/R3C96dqJBUI/AAAAAAAAAEo/j3csPO0ig7o/s288/02.JPG" Height = "192" width = "288"/>
<Media: Content url = "http://lh3.google.com/pengpengsay/R3C96dqJBUI/AAAAAAAAAEo/j3csPO0ig7o/02.JPG" Height = "400" width = "600" type = "image/JPEG" medium = "image"/>
<Media: Credit> Chenggang </media: Credit>
</Media: group>

XML address: http://picasaweb.google.com/pengpengsay/lNFxFK

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.