tags:

views:

61

answers:

2

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 ?

+1  A: 

I would check out using Linq to XML

Querying Xml: http://msdn.microsoft.com/en-us/library/bb308960.aspx#xlinqoverview_topic3a

Kevin
+1  A: 

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