C ドライブの data ディレクトリにある contents.xml というファイルに、次の XML があります。
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xml:base="http://datacenter1.table.core.windows.net/"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns="http://www.w3.org/2005/Atom">
<title type="text">TestContents</title>
<entry>
<title type="text" />
<author>
<name />
</author>
<link rel="edit" title="TestContents" />
<content type="application/xml">
<m:properties>
<d:PartitionKey>0100000</d:PartitionKey>
<d:Text>xx</d:Text>
</m:properties>
</content>
</entry>
<entry>
<title type="text" />
<updated />
の値を取得する必要があるため、次の<d:Text>
コンソール アプリケーションを作成しました。
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
XDocument xmlDoc = XDocument.Load(@"c:\data\contents.xml");
var q = from c in xmlDoc.Descendants("entry")
select (string)c.Element("link") ;
Console.WriteLine(q);
}
}
}
しかし、私には2つの問題があります。最初にコンソールが表示されますが、出力が表示される前に消えます。次に、デバッガーで q を見ると、「列挙は結果を返しません」と表示されます。
多くの値である本当に必要なものを取得するために使用できる最良の方法は何<d:Text>
ですか?