You don't need to create a new XDocument before calling XDocument.Parse. This won't cause any problems, it's just pointless.
However, this line is wrong because email is not a child of the document root:
doc.Element("email").Value;
Your second example looks fine. This works for me:
string s = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><searchResponse requestID=\"500\" status=\"success\"><pso><psoID ID=\"61F2C644-F93A-11DE-8015-73A11AB14291\" targetID=\"mezeoAccount\"><data><email>[email protected]</email><quotaMeg>2048</quotaMeg><quotaUsed>1879736</quotaUsed><active>true</active><unlocked>true</unlocked><allowPublic>true</allowPublic><realm>mezeo</realm><bandwidthQuota>1000000000</bandwidthQuota><billingDay>1</billingDay></data></psoID></pso></searchResponse>";
XDocument doc = XDocument.Parse(s);
foreach (XElement e in doc.Descendants("data"))
Console.WriteLine(e);
Result:
<data>
<email>[email protected]</email>
<quotaMeg>2048</quotaMeg>
<quotaUsed>1879736</quotaUsed>
<active>true</active>
<unlocked>true</unlocked>
<allowPublic>true</allowPublic>
<realm>mezeo</realm>
<bandwidthQuota>1000000000</bandwidthQuota>
<billingDay>1</billingDay>
</data>
In response to your second third question (see comments to this answer) try this:
using System;
using System.Xml.XPath;
using System.Xml.Linq;
class Program
{
public static void Main()
{
string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><searchResponse requestID=\"500\" status=\"success\"><pso><psoID ID=\"61F2C644-F93A-11DE-8015-73A11AB14291\" targetID=\"mezeoAccount\"><data><email>[email protected]</email><quotaMeg>2048</quotaMeg><quotaUsed>1879736</quotaUsed><active>true</active><unlocked>true</unlocked><allowPublic>true</allowPublic><realm>mezeo</realm><bandwidthQuota>1000000000</bandwidthQuota><billingDay>1</billingDay></data></psoID></pso></searchResponse>";
XDocument doc = XDocument.Parse(xml);
foreach (XElement e in doc.XPathSelectElements("/searchResponse/pso/psoID/data/*"))
Console.WriteLine(e);
}
}
Output:
<email>[email protected]</email>
<quotaMeg>2048</quotaMeg>
<quotaUsed>1879736</quotaUsed>
<active>true</active>
<unlocked>true</unlocked>
<allowPublic>true</allowPublic>
<realm>mezeo</realm>
<bandwidthQuota>1000000000</bandwidthQuota>
<billingDay>1</billingDay>