-4

i just got an account at:

http://www.whoisxmlapi.com/index.php#/whois-api-doc.php?rid=1

ive never parsed XML with c#, how would i get the information in the <email> tag ?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Alex Gordon
  • 57,446
  • 287
  • 670
  • 1,062
  • 1
    Seriously use Google after looking at your profile most of your questions are easily answered with a simple Google Search: http://tinyurl.com/y3kuuvs – Tigraine Apr 14 '10 at 18:43
  • 1
    Tigraine has a point; if you learn to Google up answers for yourself, you'll be a much more productive person. – user229044 Apr 15 '10 at 21:09

1 Answers1

1

I know of three options:

XmlDocument example:

XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
string email = doc.SelectSingleNode("/WhoisRecord/registrant/email").InnerText;

XmlReader example:

using (XmlReader reader = new XmlTextReader(new StringReader(xml)))
{
    reader.Read(); 
    reader.ReadStartElement("WhoisRecord");  
    reader.ReadStartElement("registrant");  
    reader.ReadStartElement("email");  
    reader.ReadString().Dump();
}
drs9222
  • 4,448
  • 3
  • 33
  • 41