XML获取字符串的IMG标签 string Convert To XML

string str="<IMG height=/"372/" alt=/"aa/" src=/"http://192.168.1.1/Web1/images/image.jpg/" width=/"522/" border=/"0/" />";

XmlDocument xDoc = new XmlDocument();          
 
xDoc.Load(new System.IO.MemoryStream(System.Text.Encoding.GetEncoding ("UTF-8").GetBytes (str)));   
 
XmlNodeList xNode = xDoc.SelectNodes("//IMG");  
 
        {  
 
            for (int i = 0; i < xNode.Count; i++)  
 
            {  
 
              Response.Write ( xNode[i].Attributes["src"].Value);                 
 
            }  
 
        } 


本文转载:CSDN博客