我刚刚在以下地址获得了一个帐户:
http://www.whoisxmlapi.com/index.php#/whois-api-doc.php?rid=1
我从未使用 c# 解析过 XML,我将如何获取<email>
标签中的信息?
我刚刚在以下地址获得了一个帐户:
http://www.whoisxmlapi.com/index.php#/whois-api-doc.php?rid=1
我从未使用 c# 解析过 XML,我将如何获取<email>
标签中的信息?
我知道三个选项:
XML文档示例:
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
string email = doc.SelectSingleNode("/WhoisRecord/registrant/email").InnerText;
XmlReader 示例:
using (XmlReader reader = new XmlTextReader(new StringReader(xml)))
{
reader.Read();
reader.ReadStartElement("WhoisRecord");
reader.ReadStartElement("registrant");
reader.ReadStartElement("email");
reader.ReadString().Dump();
}