私はこのようなコードを開発しました:
String resultString = await response.Content.ReadAsStringAsync();
Stream resultStream = await response.Content.ReadAsStreamAsync();
XElement rootElement = XDocument.Load(resultStream).Elements().First();
XElement blobs = rootElement.Element("Blobs");
foreach (var blob in blobs.Elements("Blob"))
{
var t = blob;
}
resultString
とresultStream
は から来ていますHttpClient reposnse
。次のように、Azure BLOB REST サービス (リスト) から応答を取得します。
<EnumerationResults>
<Blobs>
<Blob>
<Name></Name>
<Url></Url>
<Properties></Properties>
</Blob>
<Blob>
<Name></Name>
<Url></Url>
<Properties></Properties>
</Blob>
</Blobs>
</EnumerationResults>
私のコードでは、IEnumerable<XNode>
fromを取得できましたが、要素にアクセスしたり内部にアクセスしたり<Blobs>
することはできません。すべてを1行の文字列として取得します。それぞれを取得して取得するには、コードをどのように変更する必要がありますか?Name
Url
<Blob>
<Blob>
<Name>
<Url>