XML : Get attribute when it has colon in xml file using c#

I met a question that I can't get the attribute in the xml when the colon exists. For example, I want to get the value but it seems not working with my code. Any suggestions?

For Example:

  Xml content:  <ext-link xlink:href="http://www.ncbi.nlm.nih.gov/books/NBK154461/" ext-link-type="uri" xmlns:xlink="http://www.w3.org/1999/xlink">http://www.ncbi.nlm.nih.gov/books/NBK154461/</ext-link>      My code:  foreach(XElement xeTmp in Elementlist)  {  string strValue = xeTmp.Attribute("xlink:href").Value;  }    

Exception: {"The ':' character, hexadecimal value 0x3A, cannot be included in a name."}

please suggest how to fixed it

No comments:

Post a Comment